Others

How to Reset or Replace Access AutoNumber Values After Deleting Records

Huda QurayshiHuda Qurayshi Oct 12, 2026 869 views

Question details

The user needs to reset or fill gaps in Microsoft Access AutoNumber fields after deleting records.

How to Reset or Replace Access AutoNumber Values After Deleting Records
Product
Microsoft Access
Device & OS
not provided
Scenario
Deleting records in a database leaves gaps in the AutoNumber sequence, and the user is looking for a way to maintain a continuous, unbroken sequence.
Observed behavior
The AutoNumber field skips numbers where previous records were deleted, creating permanent gaps instead of renumbering the remaining records.
Before you start

Before modifying database fields, understand that AutoNumber fields are designed solely as unique identifiers, not for sequential, gap-free numbering. Changing them in existing records can severely compromise your database integrity.

Solution 1Recommended

Use Compact and Repair Database for Recent Deletions

Use this built-in tool if you only deleted the most recent records at the end of the table and want the next new record to resume from the last existing number.

This method is safe because it only resets the auto-increment seed for future records. It will not attempt to fill gaps caused by older records being deleted in the middle of your dataset.

1
Open the Database

Launch Microsoft Access and open the database containing the table with the deleted records.

2
Navigate to Database Tools

Click on the 'Database Tools' tab located in the top ribbon menu.

3
Run Compact and Repair

Click on the 'Compact and Repair Database' button. The database will process and reset the AutoNumber seed to sequentially follow the highest existing ID.

Use Compact and Repair Database for Recent Deletions
Limitation: This will not remove gaps left by older records. If you deleted ID 5 but kept ID 6, the next ID will still be 7.
Free Microsoft Office alternative

Looking for a Lightweight and Free Office Suite?

While Microsoft Access is used for complex relational databases, most everyday data tracking, spreadsheets, and documentation can be handled efficiently with WPS Office. It provides a highly compatible, free alternative to Microsoft Office's core applications.

  1. 1. Visit the WPS Office website: Go to the official WPS Office homepage to access the latest version.
  2. 2. Download the Installer: Click on 'Free Download' to get the lightweight installation file.
  3. 3. Install and Run: Follow the on-screen instructions to install WPS Office and open your existing Office files instantly.
Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Free, lightweight, and fast-loading compared to traditional heavyweight Office suites.Familiar tabbed user interface, making the transition from Microsoft Office seamless.Powerful built-in spreadsheet functions for complex data sorting and numbering.
microsoft office alternative - wps office

Frequently Asked Questions

Why shouldn't I reset AutoNumber values in Access?

AutoNumber fields are designed to be meaningless, unique identifiers that maintain relational database integrity. Changing them can break foreign key relationships with other tables, leading to orphaned records and severe data corruption.

How do I fill gaps in an existing AutoNumber sequence?

You cannot and should not attempt to fill gaps in an AutoNumber field. If your business logic strictly requires a gap-free sequence, you must create a separate custom Number field and use VBA code to manually assign or recalculate the sequence.

Does Compact and Repair fix all AutoNumber gaps?

No. The Compact and Repair utility only resets the next available AutoNumber sequence if you deleted the most recently added records at the very end of the table. It does not renumber existing records or fill historical gaps in the middle of your dataset.