|
 |
 |
 |
 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
Trademarks
Article ID: 207868 - Last Review: June 24, 2004 - Revision: 2.0 ACC2000: "Microsoft Access Can't Represent the Join Expression" Error Message in Query DesignThis article was previously published under Q207868 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
After you create a query with the Simple Query Wizard in Microsoft Access, 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.
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.
You can use either of the following methods 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]);
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. Steps to Reproduce ProblemCreating the Tables- Open the sample database Northwind.mdb.
- 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
- 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.
- On the Edit menu, click Primary Key.
- Save the tblOne table and close it.
- 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
- Save the tblTwo table and close it. You do not need to create a primary key.
Creating the Relationships- On the Tools menu, click Relationships.
- When the Relationships window opens, click Show Table on the Relationships menu.
- In the Show Table dialog box, double-click tblOne and then tblTwo. Click Close.
- 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.
- Drag the selected fields Key1, Key2, and Key3 from the tblOne table, which invokes the Edit Relationships dialog box.
- Add fields Key1, Key2, and Key3 from the tblTwo table in the Related Table/Query column, so that the Edit Relationships dialog box looks like this:
Table/Query: tblOne Related Table/Query: tblTwo
-------------------------------------------------
Key1 Key1
Key2 Key2
Key3 Key3
- Click Create.
- Close the Relationships window and save the changes.
Creating the Query- In the Database window, click Queries under Objects, and then click New.
- In the New Query dialog box, select Simple Query Wizard, and then click OK.
- In the Simple Query Wizard dialog box, select tblOne in the Tables/Queries list. Then, add Field1 to the Selected Fields box.
- Still on the same screen of the Simple Query Wizard dialog box, select tblTwo in the Tables/Queries list. Then, add all of the fields from that table to the Selected Fields box.
- 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.
- On the View menu, click Design View. Note that you receive the error message mentioned in the "Symptoms" section.
For more information about creating relationships between tables, click Microsoft Access Help on the
Help menu, type create or modify relationships in the Office Assistant or
the Answer Wizard, and then click Search to view the topics
returned.
APPLIES TO- Microsoft Access 2000 Standard Edition
| kberrmsg kbbug kbpending KB207868 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
|
 |
 |
 |
 |
 |
 |
 |
| |