ACC: Two Tables Automatically Joined in Query

Last reviewed: May 28, 1997
Article ID: Q113885
The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

If you create a query based on two or more tables that have matching field names with matching data types, and one of the tables has a primary key defined, Microsoft Access will automatically join the tables on the matching field names.

RESOLUTION

Create the table relationships you want in the Relationships window before you create new queries. If you do not create the relationships you want first, you will have to delete the automatic join line in the query.

In Microsoft Access 7.0 and 97, you may disable AutoJoin entirely by clicking Options on the Tools menu, clicking the Tables/Queries tab, and clearing the check box labeled "Enable AutoJoin."

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In a new database, create a new table as follows and save it:

          Table: Employees
          -------------------------------
          Field Name: ID
    
             Data Type: AutoNumber (or Counter in version 2.0)
             Indexed: Yes (No Duplicates)
    
          Table Properties: Employees
          -------------------------------
          PrimaryKey: ID
    
    

  2. Create another new table as follows and save it.

          Table: Customers
          -------------------------------
          Field Name: EmployeeID
    
             Data Type: Number
             Field Size: Long Integer
             Indexed: No
          Field Name: ID
             Data Type: AutoNumber (or Counter in version 2.0)
             Indexed: No
    
    

  3. Save the table as Customers. Do not create a primary key.

  4. Create a new query based on the Employees and Customers tables. Note that the tables are automatically joined on the ID field, where the desired join is from Customers.EmployeeID to Employees.ID.

To delete the join line, select it, and then press DELETE.

REFERENCES

For more information about joining tables in queries with join lines, search for "join," and then "join tables" or ask the Microsoft Access 97 Office Assistant.


Keywords : kbusage QryJoin
Version : 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


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 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.