Why is this a type mismatch error

  • Thread starter Thread starter Robert Solomon
  • Start date Start date
R

Robert Solomon

Hi. I am trying to copy code from an Access 97 database into an Access
2002 database.

Private Sub Form_Open(Cancel As Integer)
Dim rst As Recordset, lastcnt As Integer

Set rst = Me.RecordsetClone <-- error occurs at this line

rst.MoveLast
lastcnt = rst.RecordCount

Set rst = Nothing

DoCmd.GoToRecord acForm, "Masterform", acGoTo, lastcnt - 6
End Sub

I am getting a type mismatch at the Set rst = Me.RecordsetClone
statement. Searching the help files give me examples that look exactly
like what I'm doing. So why am I getting this error?

Thanks,
Rob
 
Me.RecordsetClone uses DAO, so you will need to have a reference set to the
Microsoft DAO 3.6 Object Library. Then, to dis-ambiguate your Recordset
declaration from an ADO recordset, declare it as follows:

Dim rst as DAO.Recordset
 
I need more instruction. How do I create a reference set to the DAO 3.6
Object library? Just adding the Dim sttmnt you suggested keeps crashing
Access.

Thanks for your prompt help
Rob
 
Open any code module by pressing ALT-F11. Then, from the VB menu, select
Tools|References. Scroll through the available references until you find
the Microsoft DAO 3.6 Object Library. Click the checkbox to the left of
the library name, then click OK.
 
Back
Top