G
George
Hi,
I have following code which runs fine:
------------------------------------
Dim cnn As Connection
Dim rsStudent As ADODB.Recordset
Dim strStudentSQL As String
Set cnn = CurrentProject.Connection
Set rsStudent = New ADODB.Recordset
strStudentSQL = "Select * from students"
rsStudent.ActiveConnection = cnn
rsStudent.Open strStudentSQL
MsgBox rsStudent.Fields("StdID")
------------------------------------
But it seems some properties of the recordset such as "moveLast",
"recordcount" and etc are not available. The recordcount always return -1,
and when excute "MoveLast" or "MovePrevious" , I got error
message:"Operation is not allowed in this context".
I think this is because of the connection properties, but it is not allowed
to change the connectionstring when the connection is open.
How to fix this problem?
Thanks!
George
I have following code which runs fine:
------------------------------------
Dim cnn As Connection
Dim rsStudent As ADODB.Recordset
Dim strStudentSQL As String
Set cnn = CurrentProject.Connection
Set rsStudent = New ADODB.Recordset
strStudentSQL = "Select * from students"
rsStudent.ActiveConnection = cnn
rsStudent.Open strStudentSQL
MsgBox rsStudent.Fields("StdID")
------------------------------------
But it seems some properties of the recordset such as "moveLast",
"recordcount" and etc are not available. The recordcount always return -1,
and when excute "MoveLast" or "MovePrevious" , I got error
message:"Operation is not allowed in this context".
I think this is because of the connection properties, but it is not allowed
to change the connectionstring when the connection is open.
How to fix this problem?
Thanks!
George