You receive a "Type mismatch" error when you run the OpenRecordset method
Article ID: 181542
Article Last Modified on 1/12/2006
APPLIES TO
- Microsoft Visual Basic 5.0 Enterprise Edition
- Microsoft Visual Basic 6.0 Enterprise Edition
- Microsoft ActiveX Data Objects 2.7
- Microsoft ActiveX Data Objects 2.1 Service Pack 2
- Microsoft ActiveX Data Objects 2.5
- Microsoft ActiveX Data Objects 2.6
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 6.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 6.0 Professional Edition
- Microsoft Access 2000 Standard Edition
This article was previously published under Q181542
SYMPTOMS
If you dimension an object as a
Recordset and then set that object to
databaseobject.OpenRecordset(source), you may receive the following error
message:
Run time error '13': Type mismatch
CAUSE
If your project contains references to both the Data Access Objects (DAO)
library and the ActiveX Data Objects (ADO) library, you may see multiple
Recordset entries in the list when you dimension the Recordset object.
This error occurs when you list the ADO library with a higher priority than
the DAO library in the References dialog box, regardless of which Recordset
entry you select from the list.
RESOLUTION
If you need only the DAO
Recordset object, make sure that the reference for
the DAO object library has a higher priority in the
References dialog box,
or clear the reference to Microsoft ActiveX Data Objects.
If you must reference and use both DAO and ADO
Recordset objects,
dimension the objects explicitly as follows:
Dim adoRS As ADODB.Recordset
Dim daoRS As DAO.Recordset
Additional query words: OpenRecordset DAO mismatch run time error 13 type
Keywords: kbprb KB181542