RecordsetClone Error

  • Thread starter Thread starter John
  • Start date Start date
J

John

I recently changed a replicated database back to a standard database by
importing all objects minus the system fields in the tables. I have one
problem with a form. There are navagation buttons on the form and an event
procedure in the "On Current" form property.

Private Sub Form_Current()
Dim recClone As Recordset

Set recClone = Me.RecordsetClone()

Seems straight forward, but when it runs I get Run-time error '13', Type
mismatch. The "Set recClone= Me.RecordsetClone()" line is highlighted
when I click on Debug. Everything else on the form works ok, but each time a
new record is loaded I get this error.

Any help appreciated

John
 
Seems straight forward, but when it runs I get Run-time error '13', Type
mismatch. The "Set recClone= Me.RecordsetClone()" line is highlighted
when I click on Debug.

This suggests that your new database (in Access2000 or perhaps an
early release of XP I'm guessing) had the ADO library selected and the
DAO library not. Open the VBA editor; select Tools... References from
the menu; and be sure that Microsoft DAO 3.51 Object Library (highest
version number, I think that's right for XP) is checked, and (unless
you're using ADO) that Microsoft ActiveX Data Objects is unchecked.

Both these libraries have Recordset objects... but they are DIFFERENT
recordset objects. A Form's RecordsetClone is a DAO recordset.

If you do need both ADO and DAO, just use

Dim recClone As DAO.Recordset

to disambiguate.

John W. Vinson[MVP]
 
Spot on John, thanks a lot

John


John Vinson said:
This suggests that your new database (in Access2000 or perhaps an
early release of XP I'm guessing) had the ADO library selected and the
DAO library not. Open the VBA editor; select Tools... References from
the menu; and be sure that Microsoft DAO 3.51 Object Library (highest
version number, I think that's right for XP) is checked, and (unless
you're using ADO) that Microsoft ActiveX Data Objects is unchecked.

Both these libraries have Recordset objects... but they are DIFFERENT
recordset objects. A Form's RecordsetClone is a DAO recordset.

If you do need both ADO and DAO, just use

Dim recClone As DAO.Recordset

to disambiguate.

John W. Vinson[MVP]
 
Back
Top