How to Keep Access Forms Sorted After Selecting Records
Question details
The user needs to maintain the custom date-based sort order in an Access form after executing a Select All or Deselect All action.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Using custom buttons to select or deselect records, which triggers UPDATE statements on the form's data.
- Observed behavior
- The form loses its date-based sort order and resets to default after the buttons are clicked, likely due to a Requery command or an ORDER BY clause.
Before editing your VBA code or form properties, ensure you create a backup copy of your Access database to prevent accidental data or logic loss.
Remove Unnecessary Requery Commands in VBA
Prevent the form from reloading its recordset and clearing the user's sort order by removing or commenting out the Requery command.
The most common cause of losing interactive sort orders is the use of the Requery method. Because your UPDATE statements only modify existing records without inserting or deleting them, requerying the entire recordset is usually unnecessary.
Launch your Access database, navigate to the Navigation Pane, right-click the form experiencing the sorting issue, and select 'Design View'.
Right-click the 'Select All' or 'Deselect All' button and select 'Build Event' to open the VBA editor for the button's Click event.
Scroll through the VBA code to find the 'Me.Requery' or similar requery command that executes after your UPDATE statements.
Add an apostrophe (') at the beginning of the Requery line to comment it out (e.g., 'Me.Requery). Save your changes and test the form.

Review the Form's RecordSource for ORDER BY Clauses
Ensure that the form's underlying query does not contain a hardcoded ORDER BY clause that overrides interactive sorting.
Looking for a Lightweight Alternative for Daily Office Tasks?
While Microsoft Access handles complex databases, WPS Office is the perfect free alternative for your daily document, spreadsheet, and presentation needs. It is lightweight, fast, and fully compatible with major office formats.
- 1. Visit the WPS website: Go to the official WPS Office website to find the latest version.
- 2. Download the installer: Click the 'Free Download' button to download the setup file for your operating system.
- 3. Install and launch: Run the downloaded installer, follow the simple on-screen instructions, and launch WPS Office to start working.

Frequently Asked Questions
Why does my Access form reset its sort order when I click a button?
This typically happens if the button's VBA code contains a Requery command. Requerying forces the form to reload its entire recordset from the database, which drops any custom sort orders or filters applied by the user.
What is the difference between Requery and Refresh in Access?
Requery reloads the entire recordset, capturing new or deleted records but resetting user filters and sorts. Refresh only updates the data in the existing records currently being displayed, keeping your interactive sort order and position intact.
How can I sort an Access form using VBA without losing user settings?
You can set the form's OrderBy property in VBA (e.g., Me.OrderBy = "DateDesc") and then set Me.OrderByOn = True to apply a specific sort programmatically without requerying the whole dataset.




