View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dmoney Dmoney is offline
external usenet poster
 
Posts: 42
Default Problem with the following code

Give this a shot.

Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As
Long, c As Long

cn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0; "
_
& "Data Source=C:\Access Data\DoctorBlades.mdb;"
cn.Open
cn.CursorLocation = adUseClient
rs.Open "tblDoctorBlades", cn, adOpenDynamic,
adLockOptimistic

-----Original Message-----
Can anyone tell me what may be wrong with the following

code?
It generates an error when it tries to execute the .Open

for the recordset.
I am trying to connect to the database, open the table,

and bring data back
to an excel spreadsheet. Also, is the same procedure

used to open a query
that is stored in the access database that is used to

open a table.

Any help would be greatly appreciated.
Thanks
Vince


Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As

Long, c As Long
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.Oledb.4.0; " & _
"Data Source=C:\Access Data\DoctorBlades.mdb;"

Set rs = New ADODB.Recordset

With rs
.Open "tblDoctorBlades", cn, adOpenDynamic,

adLockOptimistic
End With

.