R
redrover
I hope someone can tell me how to open a query when I load a form. I need
to read the query records and combine information from several records to
create the information displayed in the form. I can't combine the
information properly with queries alone so I want to execute the VBA code to
do that. I'm having difficulty getting the recordset open so I can read it.
My code:
Dim cnn as ADODB.Connection
Set cnn = CurrentProject.Connection
Dim strSQL As string
Dim rst As ADODB.Recordset
strSQL = "Select * FROM qryCompTrScore order by [Combcde]"
set rst = CurrentDb.OpenRecordset (strSQL, dbOpenDynaset, dbReadOnly,
dbPessimistic)
The code executes until it gets to the 'set rst' statement. How do I get
the recordset open?
to read the query records and combine information from several records to
create the information displayed in the form. I can't combine the
information properly with queries alone so I want to execute the VBA code to
do that. I'm having difficulty getting the recordset open so I can read it.
My code:
Dim cnn as ADODB.Connection
Set cnn = CurrentProject.Connection
Dim strSQL As string
Dim rst As ADODB.Recordset
strSQL = "Select * FROM qryCompTrScore order by [Combcde]"
set rst = CurrentDb.OpenRecordset (strSQL, dbOpenDynaset, dbReadOnly,
dbPessimistic)
The code executes until it gets to the 'set rst' statement. How do I get
the recordset open?