Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Error message when you convert a database file from an earlier version of Access into an Access 2007 file: "Run-time error '13': Type mismatch"


Symptoms

When you convert a database file from an earlier version of Microsoft Access into a Microsoft Office Access 2007 file, the application may stop responding if you try to run or compile code that uses Data Access Objects (DAO). Additionally, you may receive the following error message:
Run-time error ‘13’:

Type mismatch

↑ Back to the top


Cause

This problem occurs because the order of database references is not preserved when the database file is converted.

↑ Back to the top


Workaround

To work around this problem, use one of the following methods:

Method 1

In the References dialog box, make sure that Microsoft Office 2007 Access database engine Object Library is higher in priority than Microsoft ActiveX Data Objects. To do this, follow these steps:
  1. Start Access 2007.
  2. Click the Microsoft Office Button, and then click Open.
  3. In the Open dialog box, locate and select <DatabaseName>, and then click Open.
  4. On the Database Tools menu, click Visual Basic in the Macro group to open Visual Basic Editor (VBE).

    Note You may also press ALT+F11 to open VBE.
  5. On the Tools menu, click References.
  6. In the References - <DatabaseName> dialog box, click Microsoft Office 2007 Access database engine Object Library.
  7. Click the Priority arrow to move Microsoft Office 2007 Access database engine Object Library above Microsoft ActiveX Data Objects, and then click OK.

Method 2

If you must reference and use both DAO and ActiveX Data Objects (ADO) object libraries, dimension the objects explicitly as follows:
Dim adoRS As ADODB.Recordset 
Dim daoRS As DAO.Recordset

Method 3

If you are not using an ADO object library, clear the reference to the library. To do this, follow these steps:
  1. Start Access 2007.
  2. Click the Microsoft Office Button, and then click Open.
  3. In the Open dialog box, locate and select <DatabaseName>, and then click Open.
  4. On the Database Tools menu, click Visual Basic in the Macro group to open VBE.
    Note You may also press ALT+F11 to open VBE.
  5. On the Tools menu, click References.
  6. In the References - <DatabaseName> dialog box, click to clear Microsoft ActiveX Data Objects, and then click OK.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


Keywords: kberrmsg, kbtshoot, kbentirenet, kbexpertiseinter, kbprb, kb

↑ Back to the top

Article Info
Article ID : 927678
Revision : 1
Created on : 1/7/2017
Published on : 10/15/2007
Exists online : False
Views : 172