I've got this bit of code in a VBA module:
But, the line:
.ActiveConnection = c
is generating the error:
Run-time error '3709':
Requested operation requires an OLE DB Session object, which is not supported by the current provider
I've run code similar to this before with no problems. Any advice would be appreciated!
Code:
Sub test()
Dim c As ADODB.Connection
Dim m As ADODB.Command
Dim r As ADODB.Recordset
Set c = New ADODB.Connection
With c
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\mydb.mdb;User Id=Admin;Password="
.ConnectionTimeout = 10
.CursorLocation = adUseServer
.Open , , , adAsyncConnect
End With
With m
[COLOR=red] .ActiveConnection = c[/color]
.CommandType = adCmdText
.CommandText = "select x from tblTable1"
End With
r.Open c, , adOpenDynamic, adLockReadOnly, adCmdText
End Sub
But, the line:
.ActiveConnection = c
is generating the error:
Run-time error '3709':
Requested operation requires an OLE DB Session object, which is not supported by the current provider
I've run code similar to this before with no problems. Any advice would be appreciated!