Microsoft KB Archive/257532

= ACC2000: Sort Order Lost When You Edit Records in a Microsoft Access Project =

Article ID: 257532

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q257532





This article applies only to a Microsoft Access project (.adp).

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



SYMPTOMS
In a Microsoft Access project, if you use the Sort Ascending or Sort Descending commands to sort a table by one or more of its fields, any attempt to edit the sorted field causes the sort order to be lost.



RESOLUTION
In the Microsoft Access project, create a stored procedure that sorts the data and then displays the data in the correct order. The following steps use the Employees table in NorthwindCS.adp to show you an example of how to do this.  CAUTION: If you follow the steps in this example, you modify the sample Access project NorthwindCS.adp. You may want to back up the NorthwindCS.adp file and follow these steps on a copy of the project.

 Open the sample project NorthwindCS.adp. Click Stored Procedures under Objects.  Click New, and then type the following script into the new stored procedure: Create Procedure "SortLastName" As SELECT * FROM Employees ORDER BY LastName return  Close the stored procedure, click Yes to save the changes, and then save the new stored procedure with the default name of SortLastName. Double-click SortLastName to open a recordset based on the Employees table in Datasheet view.</li> Change the last name Fuller to Fullerton.

Note that you are able to edit the LastName field without losing the sort order.</li></ol>

<div class="status_section">

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

<div class="moreinformation_section">

Steps to Reproduce the Behavior
CAUTION: If you follow the steps in this example, you modify the sample Access project NorthwindCS.adp. You may want to back up the NorthwindCS.adp file and follow these steps on a copy of the project.


 * 1) Open the sample project NorthwindCS.adp.
 * 2) Click Tables under Objects, and then double-click the Employees table.
 * 3) Right-click on the LastName column, and then click Sort Ascending.
 * 4) Change the last name Fuller to Fullerton. Note that the sort order is lost, and that it reverts to the table's default sort order.

Additional query words: pra

Keywords: kbbug kbclientserver kbpending KB257532

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.