ACC: Query Join Type Mismatch Errors Caught at Run Time

Last reviewed: May 7, 1997
Article ID: Q96581
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SUMMARY

Novice: Requires knowledge of the user interface on single-user computers.

Microsoft Access does not detect a type mismatch error involving joins created in a query until you run the query.

MORE INFORMATION

To illustrate when Microsoft Access detects a type mismatch error involving joins in a query, follow these steps.

CAUTION: Following the steps in this example will modify the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0). You may want to back up the Northwind.mdb (or NWIND.MDB) file and perform these steps on a copy of the database.

  1. Open the sample database Northwind.mdb.

  2. Create a new query in Design view.

  3. In the Add Table dialog box, add the Orders and Products tables, and then click Close.

  4. Create a join between the EmployeeID field in the Orders table and the ProductName field in the Products table.

    NOTE: In versions 1.x and 2.0, there is a space in Employee ID and Product Name.

  5. Add all fields from both tables to the Field row of the QBE grid.

  6. On the Query menu, click Run. Note that the query begins to process, and then returns the following error message:

    In Microsoft Access 7.0 and 97:

          ! Type mismatch in JOIN expression
    

    In Microsoft Access 1.x and 2.0:

          ! Type mismatch
    

    Click OK to clear the error, or click Help for information about the possible causes of this error.

It may not be obvious that the join is at fault because of the timing of the error message, especially if you are querying large amounts of data over a network. The join in this example is between a Long Integer data type, EmployeeID, and a Text data type, ProductName. The mismatch between the data types in the join is what generates the error at run time.

This issue is one reason why it is advantageous to create relationships between tables before you create queries.


Additional query words: code 13
Keywords : kberrmsg kbusage QryJoin
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbinfo


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.

Last reviewed: May 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.