views:

138

answers:

3

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?

A: 

How are you bringing the data back? It should be possible to append the data from your table and to keep the existing numbers.

It is necessary however, that you paste from an integer field to the autonumber field. You cannot change a field to autonumber from integer once there is data in the field, but you can change to integer from autonumber.

Remou
I've bring the data back combining different tables with similar content and writhing the data back to that Table.But when I insert the records the AutoNumber field increments automatically ignoring my entries.
Pece
Is the data you are brining in an autonumber?
Remou
Yes, I've managed to make it AutoNumber, but frankly I don't know how because I've done everything same yesterday.Just coping the data in the table, and it managed.
Pece
A: 

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.

David-W-Fenton
Someone please explain the downvote, i.e., why this is an erroneous answer.
David-W-Fenton
"Autonumber field is just a long integer with a special default value" = a misstatement. I can add two such 'special default value' columns to the table (only one column may have the Autonumber property). I can use `UPDATE` to change the default value to something else (can't do that to the column with the Autonumber property). The Autonumber column can have a step value other than 1 by creating it using the `IDENTITY(<seed>, <step>)` in SQL DLL but can't do the same with a column 'special default value'. Need I go on...?
onedaywhen
All right. I've changed it. My answer *was* relevant to the issue of appending data, but not complete.
David-W-Fenton
A: 

I've manage to insert the AutoNumber fields by code from c#. I take all the data I need and just inserted in an empty table.

Pece