Recordset problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have encountered a problem with the recordset property. The wording I have
used previously in Access 97 was as follows in a form:

Dim Rs as Recordset
Set Rs = Me.RecordsetClone

I get (in Access 2000) a Type 13 error. I really don't understand it because
the data table is attached to the form and is displayed on the form when the
error message pops up.
 
prhood said:
I have encountered a problem with the recordset property. The wording
I have used previously in Access 97 was as follows in a form:

Dim Rs as Recordset
Set Rs = Me.RecordsetClone

I get (in Access 2000) a Type 13 error. I really don't understand it
because the data table is attached to the form and is displayed on
the form when the error message pops up.

This is due to the fact that Access 2000, by default, includes a
reference to the ADO object library and not the DAO library, while
Access 97 used only DAO. There's a Recordset object defined in both
libaries, but they aren't compatible. If you're working with the
recordsetclone of an Access form in an MDB file, you want to use the DAO
library, so here's what you do:

1. Open any module in the VB Editor (or press Ctrl+G or Alt+F11).

2. Click Tools -> References...

3. Locate the reference for Microsoft DAO 3.6 Object Library and put a
check in the box next to it.

4. Locate (near the top of the list) the reference to the Microsoft
ActiveX Data Objects 2.x Library and remove the check next to it.

5. Close the References dialog.

If you later find that you want to use the ADO library, you can restore
the check next to it. It would be safest for you to qualify all
declarations of objects from these libraries with the library ID, like
this:

Dim Rs As DAO.Recordset

Dim ADO_Rs As ADODB.Recordset ' ADO recordset

That will ensure that if you ever have both references set, your
declarations will be properly interpreted.
 
Thanks very much this cleared up the problem - I never thought to check the
References. The ADO library was apparently the default reference. Any reason
to prefer ADO to DAO?
 
prhood said:
Thanks very much this cleared up the problem - I never thought to
check the References. The ADO library was apparently the default
reference. Any reason to prefer ADO to DAO?

Not if you are working in an Access MDB file, and don't plan to convert
your app to an ADP any time soon.
 
Back
Top