How To Reset An AutoNumber Field Value in Access
How To Reset An AutoNumber Field Value in Access
Windows
Internet Explorer
Office
Surface
Media Player
Skype
Windows Phone
More products
SUMMARY
This step-by-step article describes how to reset an AutoNumber field value in Access. The AutoNumber field value in Access does not automatically reset when you delete some rows or all rows in a table. To reset the AutoNumber field value and to refresh the AutoNumber value in the referenced table, you must manually perform some tasks. Note You must back up your database before you perform the steps that follow.
2. 3. 4. 5. 6. 7. 8.
support.microsoft.com/kb/812718
1/3
11/18/12
2. 3. 4. 5. 6.
This changes the query type. From the Table Name list, select the new table that you created in step 2. Click OK. On the Query menu, click Run. A dialog box appears with the text that follows: You are about to paste # row(s). Click Yes to insert the rows. On the File menu, click Close. Click No to close the Append Query window. Click Tables on the left pane. Right-click the new table and then click Design View. In the Design view for the table, add an AutoNumber field with the same field name that you deleted in step 1. Add this AutoNumber field to the new table and then save the table. 13. Close the Design view window. 14. Rename the main table name. Rename the new table name to the main table name. 7. 8. 9. 10. 11. 12. In Access 2007, follow these steps: 1. Delete the AutoNumber field from the main table. Make note of the AutoNumber field name. Copy the structure of the main table, and then create a new table. Click the Create tab, and then click Query Design in the Other group. In the Show Table dialog box, select the main table. Click Add, and then click Close. To select the fields, double-click the required fields. Do this for all the fields except for the AutoNumber field in the Table view of the main table. On the Design tab, click Append in the Query Type group. This changes the query type. From the Table Name list, select the new table that you created in step 2, and then click OK. On the Design tab, click Run in the Results group. The following message appears: You are about to append # row(s) into a new table. Click Yes to insert the rows. 10. Close the query. 11. Right-click the new table, and then click Design View. 12. In the Design view for the table, add an AutoNumber field that has the same field name that you deleted in step 1. Add this AutoNumber field to the new table, and then save the table. 13. Close the Design view window. 14. Rename the main table name. Rename the new table name to the main table name.
2. 3. 4. 5. 6. 7. 8. 9.
support.microsoft.com/kb/812718
2/3
11/18/12
d. e. f. g. h. i.
In Access 2007, follow these steps: a. Click the Create tab, and then click Query Design in the Other group. This creates the new query. b. In the Show Table dialog box, select the main table and the referenced table. Click Add to add the main table and the referenced table. Click Close. c. Click the field in the main table that was previously linked to the referenced table. Use the drag-and-drop feature to put the field on the previously linked field of the referenced table. This creates the join between the tables that is based on the original linking fields. On the Design tab, click Update in the Query Type group. This changes the query type. Double-click the new field from the referenced table to add it to the field list. In the Update To field, type [Main TableName].[New AutoNumber field] to update the new field values in the referenced table. On the Design tab, click Run in the Results group. The following message appears: You are about to update # row(s). Click Yes to update the rows. i. Close the query. 6. Delete the original linking field from the main table and the referenced table. 7. Rename the new AutoNumber field to the original name. 8. Re-create the primary key and the relationship between the tables. This procedure resets your AutoNumber field and then updates the referenced table with the correct key values.
d. e. f. g. h.
MORE INFORMATION
You can also reset the AutoNumber field if you compact the database. However, this may not always work successfully with Access 2002 or later. You may have more success if you compact the database with Access 2000 and Jet 4.0 version of the Microsoft Jet Database Engine. For more information, click the following article number to view the article in the Microsoft Knowledge Base: 287756 (http://support.microsoft.com/kb/287756/ ) AutoNumber field is not reset after you compact an Access database
REFERENCES
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base: 209696 (http://support.microsoft.com/kb/209696/ ) How to use an append query to set initial value of an AutoNumber field 94821 (http://support.microsoft.com/kb/94821/ ) Use append query to set initial value of AutoNumber field 202121 (http://support.microsoft.com/kb/202121/ ) Cannot change default seed and increment value in UI
Properties
Article ID: 812718 - Last Review: August 17, 2007 - Revision: 7.3 APPLIE S TO
Microsoft Office Access 2007 Microsoft Office Access 2003 Microsoft Access 2002 Standard Edition Microsoft Access 2000 Standard Edition
Give Feedback
Back to the top
support.microsoft.com/kb/812718
3/3