ACC: How MS Access Saves Sort Order of Form Depends on Version

Last reviewed: July 15, 1997
Article ID: Q167928
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SUMMARY

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

In Microsoft Access 7.0 and 97, the sort order that you apply to a field in the form is saved when you save the form or datasheet, and is reapplied automatically when you reopen the form or base a new form or report on that object. This behavior is different from Microsoft Access 2.0. In Microsoft 2.0, the specified sort order is not reapplied when you reopen the form.

MORE INFORMATION

In Microsoft Access 7.0 and 97, the OrderBy property of the form is updated with the control name when you save the form. If you want to change this functionality, you must change the OrderBy property in the Open event of the form. The following example demonstrates how to do so.

NOTE: The OrderBy property setting for the form will not be saved if you open the form in Design view and then switch to Form view to change the settings. You must open the form in Form view and then make the necessary changes.

  1. Open the form for which you want to change the sort order in Design view.

  2. Open the property sheet for the form, and click the Event tab.

  3. Set the OnOpen property for the form to the following [Event Procedure]:

          Private Sub Form_Open(Cancel As Integer)
    

            Me.OrderBy = ""
    
          End Sub
    
    

  4. Close the module. Save and close the form.

  5. Reopen the form and change the sort order for one of your fields by clicking the Ascending (A-Z) or Descending (Z-A) button on the toolbar. Close the form.

  6. Reopen the form and note that the sort order change that you made before you closed the form has not been reapplied.

REFERENCES

For more information about sorting data in forms, search the Help Index for "sorting data, forms," or ask the Microsoft Access 97 Office Assistant.


Keywords : FmrCdbeh FmsHowto FmsProb kbusage
Version : 7.0 97
Platform : WINDOWS
Hardware : x86
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.