I get error on adUseClient why?

R

ryan.fitzpatrick3

This used to work perfectly all the time and now I get adUseClient
error? Can someone help me real quick, and if I need to change this
where abouts do i change this at? Thank you.


Dim conn As New ADODB.Connection
Dim rst As ADODB.Recordset
Dim strPath As String

strPath = "C:\Documents and Settings\rfitz03\Desktop\Ryan's
Practice Database.mdb"

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & strPath & ";"
conn.CursorLocation = adUseClient

' Create a Recordset from all the records
' in the Products table

Set rst = conn.Execute(CommandText:="SupplyPlantFlourtbl", _
Options:=adCmdTable)

' begin with the first record
rst.MoveFirst
' transfer the data to Excel
' get the names of fields first
With Worksheets("Pulled from Access").Range("A6")
.CurrentRegion.Clear
For j = 0 To rst.Fields.Count - 1
.Offset(0, j) = rst.Fields(j).Name
Next j
.Offset(1, 0).CopyFromRecordset rst
' .Offset(1, 0).CopyFromRecordset rst, 5
' .Offset(1, 0).CopyFromRecordset rst, , 2
.CurrentRegion.Columns.AutoFit
End With
rst.Close
conn.Close
End Sub


ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top