Fix Microsoft Access AutoNumber Duplicate Key Errors After an Append Query
Question details
The user needs to prevent duplicate key errors when adding records after an append query.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Records have been appended to a table that uses an AutoNumber primary key, and the user wants to add more records.
- Observed behavior
- A new AutoNumber value appears to conflict with an existing ID, causing a duplicate-value error.
Identify the destination table and confirm which field or unique index is named in the error. Check whether the append query explicitly supplies values for the AutoNumber field or lets Access generate them.
Check the Append Query and Refresh the Form
Use this first to rule out explicit ID conflicts, other unique indexes, and a stale form or recordset.
Open the destination table in Design View and select Design > Indexes. Check the primary key and any other indexes marked Unique for fields that could cause the error.
Open the append query in Design View and inspect the Append To row. If existing IDs do not need to be preserved, remove the mapping to the destination AutoNumber field so Access can generate IDs for appended records.
After the append finishes, close and reopen the form, or use a Requery action in the form's workflow. Then try adding a record again.

Compact and Repair the Access Database
Try this if the error persists and the AutoNumber seed appears to be out of sync.
Use a Separate Field for Controlled Numbering
Use a custom sequence field when users need controlled numbering, while keeping AutoNumber as the technical primary key.
Manage Tabular Data with WPS Spreadsheets
WPS Office is a free, lightweight alternative for working with spreadsheet data in a familiar interface. Open compatible Office files to move everyday tabular work to WPS, though it does not repair Access databases or replace Access relational database features.

Frequently Asked Questions
Are gaps in Access AutoNumber values a problem?
No. AutoNumber is intended to generate unique identifiers, not a gap-free sequence. Use a separate field if your workflow requires controlled numbering.
Should my append query include the AutoNumber field?
If you do not need to preserve existing IDs, open the query in Design View and remove the destination AutoNumber field from the Append To mapping. Access can then generate IDs for the appended records.
Will reopening a form fix an out-of-sync AutoNumber seed?
No. Closing and reopening the form or requerying its recordset refreshes the displayed records but does not reset the seed. Try Database Tools > Compact and Repair Database if the seed appears out of sync.
What if the duplicate error is not caused by the primary key?
Open the table in Design View and select Design > Indexes. Check other unique indexes and compare their fields with the values supplied by the append query or new record.




