Hi, I have a function associated with a form button (Access2000), part of it (see blow) is to find record count in a select query:
Private Sub Register_Click()
....
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select branch_id from branches", CurrentProject.Connection
MsgBox rs.RecordCount, vbOKOnly
....
I always get -1 returned as rs.RecordCount. I suspect it is the CurrentProject.Connection, how should I set it to open my current database where the form and tables belong?
Thank you.
Private Sub Register_Click()
....
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select branch_id from branches", CurrentProject.Connection
MsgBox rs.RecordCount, vbOKOnly
....
I always get -1 returned as rs.RecordCount. I suspect it is the CurrentProject.Connection, how should I set it to open my current database where the form and tables belong?
Thank you.