ACC97: "Can't Represent the Join Expression" in Query Design

Last reviewed: May 14, 1997
Article ID: Q161861
The information in this article applies to:
  • Microsoft Access 97

SYMPTOMS

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

After you create a query with the Simple Query Wizard in Microsoft Access 97, you may receive the following error message if you try to open the query in Design view:

   Microsoft Access can't represent the join expression
   ([<TableName>].[<FieldName>] = [<TableName>].[<FieldName>])AND
   ([<TableName>].[<FieldName>] = [<TableName>].[<FieldName>]) in Design
   view.

CAUSE

The Simple Query Wizard adds an extra set of parentheses in the join expression of the SQL Statement that it creates for the query.

The error occurs if your query meets both of the following conditions:

  • If your query is based on two or more tables.
  • If two of the tables contain a relationship or join based on a three-field primary key.

RESOLUTION

There are two methods you can use to work around this problem:

  • You can create the query in Design view without using the Simple Query Wizard.
  • You can modify the query's SQL Statement to remove the extra parentheses. Open the query in Datasheet view, and then click SQL View on the View menu to see the SQL statement. This is an example of a portion of the join expression with the extra parentheses:

          ON ([tblOne].[Key3] =[tblTwo].[Key3]) AND (([tblOne].[Key1]
          =[tblTwo].[Key1]) AND ([tblOne].[Key2] =[tblTwo].[Key2]));
    

    This is how the expression looks with the extra parentheses removed:

          ON ([tblOne].[Key3] =[tblTwo].[Key3]) AND ([tblOne].[Key1]
          =[tblTwo].[Key1]) AND ([tblOne].[Key2] =[tblTwo].[Key2]);
    

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 97. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

Creating the Tables

  1. Open the sample database Northwind.mdb.

  2. Create the following new table in Design view:

          Table: tblOne
          --------------------
          Field Name: Key1
    
             Data Type: Text
          Field Name: Key2
             Data Type: Text
          Field Name: Key3
             Data Type: Text
          Field Name: Field1
             Data Type: Number
    
    

  3. With the table open in Design view, select fields Key1, Key2, and Key3 by holding down the SHIFT key while you click the row selector button to the left of each field name, and then release the SHIFT key.

  4. On the Edit menu, click Primary Key.

  5. Save the tblOne table and close it.

  6. Create a second new table in Design view:

          Table: tblTwo
          ------------------------
          Field Name: ID
    
             Data Type: AutoNumber
          Field Name: Key1
             Data Type: Text
          Field Name: Key2
             Data Type: Text
          Field Name: Key3
             Data Type: Text
          Field Name: Field2
             Data Type Text
    
    

  7. Save the tblTwo table and close it. You do not need to create a primary key.

Creating the Relationships

  1. On the Tools menu, click Relationships.

  2. When the Relationships window opens, click Show Table on the Relationships menu.

  3. In the Show Table dialog box, double-click tblOne and then tblTwo. Click Close.

  4. In the Relationships window, select fields Key1, Key2, and Key3 in tblOne by holding down the SHIFT key while you click all three fields, and then release the SHIFT key.

  5. Drag the selected fields Key1, Key2, and Key3 from the tblOne table, which invokes the Relationships dialog box.

  6. Add fields Key1, Key2, and Key3 from the tblTwo table in the Related Table/Query column, so the Relationships dialog box looks like this:

          Table/Query: tblOne   Related Table/Query: tblTwo
          -------------------------------------------------
          Key1                  Key1
          Key2                  Key2
          Key3                  Key3
    
    

  7. Click Create.

  8. Close the Relationships window and save the changes.

Creating the Query

  1. Click the Query tab in the Database window, and then click New.

  2. In the New Query dialog box, select Simple Query Wizard, and then click OK.

  3. In the "Which fields do you want in your query?" dialog box, select tblOne in the Tables/Queries box. Then, add Field1 to the Selected Fields box.

  4. Still in the "Which fields do you want in your query?" dialog box, select tblTwo in the Tables/Queries box. Then, add all of the fields from that table to the Selected Fields box.

  5. Click Finish. The Simple Query Wizard constructs the query, and displays the results in Datasheet view. No records are displayed because there is no data in the tables.

  6. On the View menu, click Design View. Note that the error message appears.

REFERENCES

For more information about the Simple Query Wizard, search the Help Index for "Simple Query Wizard," or ask the Microsoft Access 97 Office Assistant.

For more information about creating relationships between tables, search the Help Index for "relationships, overview," or ask the Microsoft Access 97 Office Assistant.


Keywords : kberrmsg kbusage QryJoin WzOthr
Version : 97
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


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