Microsoft KB Archive/141885

= ACC: Query Sort Ignored When You Add Field to Report Footer =

Article ID: 141885

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q141885



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



SYMPTOMS
When you base a report on a query that has a sort order defined, the sort order is retained in the report. However, if you add a field to the report footer, the sort order from the query is no longer used.



CAUSE
Reports use their own internal queries. They are not designed to use a query's sort order. The fact that a query's sort order is maintained in a report without the calculated field in the report footer is by chance.



RESOLUTION
Define your report sort order in the report's Sorting And Grouping dialog box.



Steps to Reproduce Behavior

 * 1) Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.1 and 2.0).
 * 2) Create a new query based on the Orders table.
 * 3) Add the OrderID, ShipCity, and Freight fields.

NOTE: In versions 1.1 and 2.0, there is a space in the Order ID and in the Ship City fields.
 * 1) For the ShipCity field, set Sort to Ascending.
 * 2) Close and save the query as Query1.
 * 3) Create a new report based on Query1.
 * 4) Add each of the fields from Query1 to the report's detail section.
 * 5) Preview the report. Notice that the report is sorted by ShipCity.
 * 6) Add a text box to the report's footer section. Set the ControlSource property to =Sum([Freight]).
 * 7) Preview the report. Notice that the report is no longer sorted by ShipCity.

