I've lost my data in Access base, and I've manage to bring them back but when I copy the values in the table with the AutoNumber Column it increments the numbers. Is there Any way to change it to int and then bring it back to AutoNumber?
You can reset an AutoNumber field value by using a Make-Table query to create a new table that has the same data and then adding a new AutoNumber field.
In Access 2010 or newer, go to Database Tools and click Compact and Repair Database, and it will automatically reset the ID. I actually much agree with this solution - a simple C+R will reset the autonumber.
To change a field name in Access, open the table within which to rename a field in table design view. Then click into the “Field Name” column of the field whose name you wish to change. Type a new name for the field. Then click the “Save” button in the Quick Access toolbar to save your structural changes.
In the Data Type field, click the drop-down arrow and click AutoNumber. Under Field Properties, in New Values, click Increment to use incrementing numeric values for the primary key, or click Random to use random numbers.
Here is how I managed to do this in Access 2010:
This might not be a viable solution for a large table. I don't think Excel can handle more than around 65K rows.
Don't copy the data with the user interface, but append it with a query. Because an Autonumber field is just a long integer with a special default value, you can append to it values that already exist. That doesn't work in the UI, but only in SQL.
An Autonumber field has a few other properties that are different from a normal Long Integer field, but in terms of appending data, those are not relevant. One of those properties is that it is not editable once it's populated, and another is that you can have only one in each table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With