
ADO VB6 Access97 Unable to run Access Query -2147217900
Dim cnn1 As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim strCnn As String
strCnn = "Provider = Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False; Data Source=C:\Mydir\my.mdb"
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
Set rs1 = New ADODB.Recordset
rs1.CursorType = adOpenKeyset
rs1.LockType = adLockOptimistic
rs1.Open "[qryrob]", cnn1, , , adCmdText
The result is:
-2147217900 The command contained one or more errors
All I am trying to do is run a query that already exists in an Access97
mdb. Other people edit the query often so I do not want to put the
"Select etc" in my code. I am not using DSN or ASP.
If you can find fault with this code please let me know