P
Philip
Hello all.
Having problems with ADO in MSAccess XP. New to it. Have created a Access
DB, Not split (code and BD in same file). Trying to access one of the
tables in the DB with the following commands. Can you tell me where I'm
going wrong? It compiles OK, but errors on the Open line (last line shown)
Error is...
Quote
Run-time error 3709
The connection cannot be used to perfrom this operation. It is either
closed of invalid in this context.
Unquote
The relevent section of code is...
Dim MyRS As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT Pref_Cust_ID, Order_No FROM Order WHERE
(Order.Pref_Cust_ID = '" & Me!Pref_Cust_ID & "') ORDER BY Order.Order_No
DESC;"
MyRS.Open strSQL , , adOpenForwardOnly, adLockReadOnly, adCmdText
Have tryed veriety of options in this line, but it always errors. SQL
statement is not problem as I have also tryed simplifying it. No diference.
I have the following references.
VB for Apps
MS Access 11.0 Object Library
OLE Automation
MS ADO 2.7 Library
MS ADO Recordset 2.7 Library
MS ADO Ext. 2.7 for DDL and Security
MS Jet and Replication Objects 2.6 Library
Can anyone see what I'm doing wrong?
Thanks.
Having problems with ADO in MSAccess XP. New to it. Have created a Access
DB, Not split (code and BD in same file). Trying to access one of the
tables in the DB with the following commands. Can you tell me where I'm
going wrong? It compiles OK, but errors on the Open line (last line shown)
Error is...
Quote
Run-time error 3709
The connection cannot be used to perfrom this operation. It is either
closed of invalid in this context.
Unquote
The relevent section of code is...
Dim MyRS As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT Pref_Cust_ID, Order_No FROM Order WHERE
(Order.Pref_Cust_ID = '" & Me!Pref_Cust_ID & "') ORDER BY Order.Order_No
DESC;"
MyRS.Open strSQL , , adOpenForwardOnly, adLockReadOnly, adCmdText
Have tryed veriety of options in this line, but it always errors. SQL
statement is not problem as I have also tryed simplifying it. No diference.
I have the following references.
VB for Apps
MS Access 11.0 Object Library
OLE Automation
MS ADO 2.7 Library
MS ADO Recordset 2.7 Library
MS ADO Ext. 2.7 for DDL and Security
MS Jet and Replication Objects 2.6 Library
Can anyone see what I'm doing wrong?
Thanks.