syntax on ADODB recordset

  • Thread starter Thread starter smk23
  • Start date Start date
S

smk23

In the following code, I get an error "type mismatch" on the last line where
I am trying to establish a new recordset. What do I need to change?

Public Function fblnRecordNav2(frmActive As Form, _
intDirection As Integer) As Boolean

On Error GoTo Err_Unexpected

Dim rstClone As ADODB.Recordset

Set rstClone = frmActive.RecordsetClone


Thanks,
Sam
 
smk23 said:
In the following code, I get an error "type mismatch" on the last line
where
I am trying to establish a new recordset. What do I need to change?

Public Function fblnRecordNav2(frmActive As Form, _
intDirection As Integer) As Boolean

On Error GoTo Err_Unexpected

Dim rstClone As ADODB.Recordset

Set rstClone = frmActive.RecordsetClone


Do you know that the recordset of frmActive is an ADODB recordset? If the
form is in an MDB file, not an ADP, and you didn't explicitly set the form's
Recordset property to an ADODB recordset you created, then the form's
Recordset and its RecordsetClone will both be DAO recordsets, not ADODB
recordsets.

If you're dealing with a DAO recordset, then declare rstClone as such:

Dim rstClone As DAO.Recordset
 
Back
Top