ACC2000: Sort Order Lost When You Edit Records in a Microsoft Access Project (257532)



The information in this article applies to:

  • Microsoft Access 2000

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.
  1. 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.

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

    Note that you are able to edit the LastName field without losing the sort order.

STATUS

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

MORE INFORMATION

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.

Modification Type:MajorLast Reviewed:6/29/2004
Keywords:kbbug KbClientServer kbpending KB257532