Cannot open ADO Recordset
Posted on 2000-05-07
I am just starting out with ADO and I can't get a simple recordset to open. Here is my code:
'---Start of code
Set conTest = New ADODB.Connection
Set cmdTest = New ADODB.Command
Set rstTest = New ADODB.Recordset
conTest.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath
cmdTest.ActiveConnection = conTest cmdTest.CommandText = "select * from Names"
'---End of Code
Assume that all variables here are properly initialised.
Debugging through the code the connection opens fine (State indicates Open). However, when the rstTest.Open command tries to run, I get the following error:
Method 'Open' of object '_Recordset' failed.
Why? I have scoured MSDN but found nothing. Please help me open the recordset.
Thanks for your time