Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.data.ado
external usenet poster
 
Posts: 87
Default ADO newbie help please

Hi
I have an excel UserForm application, accessing an XLS file as its
database. Until now, I have just being doing my own manual reads /
writes, and have come to the conclusion it will be much neater to use
ADO, which a work colleague has introduced me to


I've been using this code

Public Sub TestUpdate()

ExcelADO "F:\TESTDB.xls", _
"UPDATE [DB$] set Nme = 'FREDDY BLOGGS' where MemIdr = 1 ;"

End Sub

Public Sub ExcelADO(filename As String, SQL As String)

Dim oRS As ADODB.Recordset
Set oRS = New ADODB.Recordset
Dim sConnect As String

sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & filename & ";" & _
"Extended Properties=Excel 8.0;"

oRS.Open SQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText
End Sub


And here's a snippet of my existing data file
http://tinyurl.com/hsjh

What happens when I run the SQL, and try and re-open the test database,
I get "Excel has caused an error in EXCEL.EXE - excel will now close"

The problem seems to be with cells H2 and J2 on the DB sheet. If I
visit both of those, press the delete key, and save the file again,
everything is hunky dory

As my real database is quite big, can my code be modified to work with
these cells, or is there some conversion routine I can run across the
spreadsheet. I've done an INSERT into an empty database with not all
fields populated, and then run the UPDATE again as above, and this
worked fine


I am a bit concerned that my database could get corrupted so easily by
something like this if something else should crop up in future. Is
there anything I can do to protect myself
--
Mike
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
Help for a newbie... please Nancie Excel Worksheet Functions 2 April 21st 06 01:48 AM
Very very new newbie Thalia Took New Users to Excel 1 September 29th 05 04:13 AM
Help for a newbie? rehr0001 Excel Worksheet Functions 4 August 18th 05 05:13 AM
JET dB Newbie Needs Help Trip Excel Discussion (Misc queries) 0 August 15th 05 07:02 PM


All times are GMT +1. The time now is 06:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"