Microsoft KB Archive/282322

= ACC2002: Name AutoCorrect Does Not Fix Changed Field Names in Union Query =

Article ID: 282322

Article Last Modified on 11/5/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q282322



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

This article applies only to a Microsoft Access database (.mdb).



SYMPTOMS
In Microsoft Access, when you attempt to run a union query, you may receive an error message similar to the following:

The ORDER BY expression includes fields that are not selected by the query. Only those fields requested in the first query can be included in an ORDER BY expression.



CAUSE
This behavior can occur if you have changed the name of one or more of the fields in a table used by the union query.



RESOLUTION
To resolve this issue, edit the union query and replace the old instance of the field name with the new field name.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Problem
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.


 * 1) Open the sample database Northwind.mdb.
 * 2) Open the Customers table in Design view.
 * 3) Replace the &quot;CompanyName&quot; field name with CoName . Close and save the table.
 * 4) Open the Customers and Suppliers by City query.

Note that you receive the error message described in the &quot;Symptoms&quot; section.

