How to restart counting from 1 after erasing table in MS Access?

前端 未结 6 2091
栀梦
栀梦 2020-11-27 04:39

I have table in MS Access that has an AutoNumber type in field ID

After inserting some rows, the ID has become 200

6条回答
  •  难免孤独
    2020-11-27 05:09

    I think the only ways to do this is outlined in this article.

    The article explains several methods. Here is one example:

    To do this in Microsoft Office Access 2007, follow these steps:

    Delete the AutoNumber field from the main table.

    1. Make note of the AutoNumber field name.
    2. Click the Create tab, and then click Query Design in the Other group.
    3. In the Show Table dialog box, select the main table. Click Add, and then click Close.
    4. Double-click the required fields in the table view of the main table to select the fields.
    5. Select the required Sort order.
    6. On the Design tab, click Make Table in the Query Type group. Type the new table name in the Table Name box, and then click OK.
    7. On the Design tab, click Run in the Results group.
    8. The following message appears:

      You are about to paste # row(s) into a new table.

      Click Yes to insert the rows.
    9. Close the query.
    10. Right-click the new table, and then click Design View.
    11. 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.
    12. Close the Design view window.
    13. Rename the main table name. Rename the new table name to the main table name.

提交回复
热议问题