Recordset "type mismatch"" with RecordsetClone error

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

Guest

Please, is anyone out there?
I plug this simple code into Northwind Products form and it works nice like
a Mercendes! Then, I plug it into my simple form named frmBuildings based on
a table called 'Buildings"and alas, it works like a beat up 1958 VW.

The message I get is "Type mismatch" on "Set rst = Me.RecordsetClone".
Unfortunately the "rst" does not seem to be recognized in some of my
procedures.

Private Sub Command14_Click()
Dim dbs As Database
Dim rst As Recordset
Dim intI As Integer
Dim fld As Field
Set dbs = CurrentDb
Set rst = Me.RecordsetClone
For Each fld In rst.Fields
' Print field names.
Debug.Print fld.Name
Next
End Sub

Any help is greatly appreciated.
Thanks
 
You don't say, so I'll have to guess. I'm assuming you're using Access 2000
or newer. If 2000 or 2002, you've added a reference to DAO, or else it would
fail on the Dim dbs As Database statement. When you did that, though, you
didn't remove the reference to ADO.

If you have both references, you'll find that you'll need to "disambiguate"
certain declarations, because objects with the same names exist in the 2
models. For example, to ensure that you get a DAO recordset, you'll need to
use Dim rst As DAO.Recordset (to guarantee an ADO recordset, you'd use Dim
rst As ADODB.Recordset)

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset
 
Thank you Douglas. You helped me see new horizons. It is worth spending hours
when feedback is so positive..
 
Back
Top