How to Reorder Records on an Access Continuous Form Using VBA
Question details
The user needs a method to move records up or down within a Microsoft Access continuous form and automatically maintain the correct sequential display order.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Customizing the display sequence of database records in a continuous form view so users can manually adjust the priority or position of items.
- Observed behavior
- Records require a dynamic sorting mechanism that updates adjacent record positions in real-time when a user changes a specific item's order priority.
Ensure your database is backed up before modifying VBA code, and verify that your underlying table has a dedicated numeric field (e.g., 'Priority' or 'Position') to store the sort order.
Implement a Numeric Priority Field and VBA Logic
Add a dedicated numeric field to track the position order and use VBA in the AfterUpdate event to renumber and sort the records dynamically.
This approach involves adding a dedicated numeric field to your database table to store the priority or position of each record. By utilizing a VBA renumbering function, you can automatically update these numbers when a record is moved up or down, ensuring the continuous form accurately reflects the newly assigned display order.
Open your underlying table in Design View and add a new Number field named 'Position' or 'Priority' to store the row order.
Open your continuous form in Design View, access the Property Sheet, and set the 'Order By' property to your newly created priority field to ensure the form sorts by this number.
Add a text box control to the continuous form and bind it to the priority field. This allows users to view and manually edit the item's position.
Open the VBA editor and insert a renumbering function (such as RowPriority). Call this logic from the priority text box control's 'AfterUpdate' event, as well as the form's 'AfterInsert' and 'AfterDelConfirm' events.

Looking for a Lightweight Alternative to Microsoft Office?
While Microsoft Access is a specialized database tool, managing standard data lists, forms, and trackers can often be done more easily in spreadsheets. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office for your daily document, spreadsheet, and presentation needs.
- 1. Download WPS Office: Visit the official WPS website to download the free installation package for your operating system.
- 2. Install the Suite: Run the installer and follow the on-screen prompts to set up WPS Office on your computer in minutes.
- 3. Organize Data in Spreadsheets: Open WPS Spreadsheet to easily manage, sort, and filter your records as an accessible alternative to complex database forms.

Frequently Asked Questions
Why aren't my Access records staying in the order I entered them?
By default, relational databases like Microsoft Access do not guarantee any specific display order unless you explicitly sort the data. You must sort the form or underlying query by a specific field, such as an ID, a date, or a custom priority number.
How do I trigger the VBA code when a user changes a record's position?
You should place your VBA execution code inside the 'AfterUpdate' event of the specific text box control that holds the priority value. This ensures the renumbering logic runs immediately after the user inputs a new position.
Do I need to renumber records when one is deleted from the form?
Yes, if you want a continuous, gapless sequence (e.g., 1, 2, 3, 4). You can trigger your custom renumbering function in the continuous form's 'AfterDelConfirm' event to normalize the remaining priority values automatically.




