DOCUMENT:Q181542 04-MAR-1998 [vbwin] TITLE :PRB: Error 13 Type Mismatch Error on DAO OpenRecordset Method PRODUCT :Microsoft Visual Basic for Windows PROD/VER:win95:5.0;winnt:5.0 OPER/SYS:Win95 winnt KEYWORDS:vb5all VBKBDAO VBKBRecordset kberrmsg ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Enterprise Edition for Windows, version 5.0 --------------------------------------------------------------------- SYMPTOMS ======== If you dimension an object as a Recordset and then set that object to databaseobject.OpenRecordset(source), you may get 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 box 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 box. 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 need to 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 MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. On the Project menu, point to References. 2. In the References dialog box, set references to both the Microsoft Data Access Objects 3.5 library and the Microsoft ActiveX Data Objects 1.5 library. 3. Make sure that the ADO library appears in the list above the DAO library. 4. Place the following code in the General Declarations section of your project: DIM dbs AS Database DIM rs AS Recordset ' When you press the spacebar after "AS," the ' list box includes multiple Recordset entries. ' Pick any Recordset item, or type "Recordset." 5. Place this code in the Form_Load procedure: SET dbs=OpenDatabase(dbname) SET rs=dbs.OpenRecordset(source) ' The error occurs when this line ' of code executes. Additional query words: OpenRecordset DAO mismatch ====================================================================== Keywords : vb5all VBKBDAO VBKBRecordset kberrmsg Version : win95:5.0;winnt:5.0 Platform : Win95 winnt Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.