Type Mismatch Error

R

Roger Carlson

If this was converted from Access 97, try adding a reference to DAO in any
code window under Tools>Reference.
 
J

John Nurick

Hi James,

At a guess this is because the references in your database have got out
of order, and
Dim RecClone as Recordset
is declaring an ADODB recordset instead of a DAO recordset (which is
what Form.RecordsetClone returns).

You can avoid the problem by using fully qualified types in your
declarations, e.g.
Dim RecClone As DAO.Recordset
 
J

JamesJ

I installed a full version of access 2002. I successfully, I believe,
imported all objects and
converted it and my data to 2002 format. The db window has (Access 2002 File
Format)
in the caption bar.
This seems occur every time I upgrade to a new version but I can never
remember how I
remedied the situation. When I try to open my main form I get a Error 13
Type Mismatch
on line marked below.

Private Sub Form_Current()

Dim RecClone As Recordset
Dim intCount As Integer
Dim intPosition As Integer

Set RecClone = Me.RecordsetClone() 'debugger points to this line.

If IsNull(Me.ctlRecID) Then

Else

RecClone.MoveLast
intCount = RecClone.RecordCount
RecClone.Bookmark = Me.Bookmark
intPosition = RecClone.AbsolutePosition + 1
lblCount.Caption = "Record " & intPosition & " of " & intCount

End If

RecClone.Close
Set RecClone = Nothing

End Sub

Any help here will be appreciated

Thanks,
James

Set RecClone = Me.RecordsetClone()
 
J

JamesJ

Declaring DAO worked.

I also created a reference, which I didn't have, to Microsoft DAO 3.6 Object
Library.
Is all this correct? Can I or should I remove the references to Microsoft
ActiveX Data Objects??

Thanks again,
James

P.S.

Another problem. I'll make separate post.
 
J

JamesJ

I created a reference, which I didn't have, to Microsoft DAO 3.6 Object
Library. This seemed to do the trick along with declaring a DAO.Recordset.

Thanks again to all,
James
 
J

John Nurick

If it was upgraded from Access 97 you probably don't need the reference
to ADO but you do need the reference to DAO.

Declaring DAO worked.

I also created a reference, which I didn't have, to Microsoft DAO 3.6 Object
Library.
Is all this correct? Can I or should I remove the references to Microsoft
ActiveX Data Objects??

Thanks again,
James

P.S.

Another problem. I'll make separate post.
 
J

JamesJ

Thanks for the assistance.
James\

John Nurick said:
If it was upgraded from Access 97 you probably don't need the reference
to ADO but you do need the reference to DAO.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top