How to Number Filtered Access Records Sequentially
Question details
The user needs a method to assign sequential numbers specifically to records returned by a filtered query, while leaving the records outside of the selection completely unchanged.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Filtering a subset of database records and generating a sequential counter only for that specific subset.
- Observed behavior
- A reliable way to isolate the filtered records, assign them a new 1-based sequence sequence, and update the main table without overwriting the sequence values of unselected records.
Before running update or make-table queries, always ensure you have created a backup copy of your Microsoft Access database (.accdb or .mdb) to prevent accidental data loss.
Use a Temporary Table with an AutoNumber Field
Create a temporary table that generates a new sequence for your filtered records, then update the original table using a join.
This approach is highly effective because it leverages the built-in AutoNumber data type to automatically generate a perfect sequence. By isolating the filtered records into a separate table, you guarantee that non-filtered records in your main table remain completely unaffected during the update process.
In Microsoft Access, go to the Create tab and select Query Design. Add your source table, select the fields you need (including the unique Record ID), apply your desired filters, and sort them in alphabetical or your preferred order. Click 'Make Table' in the ribbon to define a temporary table name.
Run the Make-Table query. This will extract your filtered subset of records and place them into the newly created temporary table.
Locate the temporary table in the Navigation Pane, right-click it, and select Design View. Add a new field (e.g., 'TempCounter') and set its Data Type to 'AutoNumber'. Save the table. Access will automatically assign a sequential number starting at 1 to all the filtered records.
Go back to Query Design and add both your original source table and the temporary table. Create a join by dragging the original Record ID from the temporary table to the Record ID in the source table.
Change the query type to 'Update'. In the query grid, add the target sequence field (e.g., 'New Counter') from your source table. In the 'Update To' row, type the name of the AutoNumber field from your temporary table (e.g., [TemporaryTable].[TempCounter]).
Click 'Run' to execute the update query. Your main table will now reflect the newly generated sequential numbers for the filtered records, while unselected records retain their existing values.

Try WPS Office for Your Spreadsheets and Documents
While Microsoft Access handles complex database management, you likely need a reliable, everyday suite for handling exported database reports, spreadsheets, and word processing. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Word, Excel, and PowerPoint.
- 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
- 2. Install the Software: Run the downloaded installer and follow the simple on-screen instructions to set up the suite in minutes.
- 3. Open Your Reports: Export your Access data as an Excel file and open it instantly in WPS Spreadsheets for further formatting and analysis.

Frequently Asked Questions
Can I generate sequential numbers directly in an Access Select Query without making a new table?
Yes, you can use the DCount function or a correlated subquery to generate row numbers dynamically in a Select Query. However, these methods can be very slow on large datasets and cannot easily be used in an Update query, making the temporary table method much more practical for permanent record updates.
Will the AutoNumber always start at 1 in the temporary table?
Yes. When you create a new table (via a Make-Table query) and then add an AutoNumber field in Design View, Microsoft Access will automatically begin the numbering at 1 and increment by 1 for every existing record in that table.
What happens if I need to run this sequential numbering process regularly?
If this is a recurring task, you can automate it using Access Macros or VBA. You can write a script that drops the old temporary table, runs the Make-Table query, uses an ALTER TABLE SQL command to add the AutoNumber field, and finally executes the Update query.




