Pietro said:
I have a table that contains an autonumber field,it was working
well,bu suddenly when i start to add a new record in a form that
depends on this table,the autonumber gives the record number 0,if i
add one more takes number 1,but if this number already exists,i get
an error message and can no longer add records.
What can i do to solve this problem
First make sure you have all your service packs installed. This is a bug
which first surfaced in Access 2000, and has been fixed with a Service pack
release. It is not hard to fix, but is time consuming and requires a
thorough knowledge of your database. ALWAYS WORK ON A COPY:
1. Compact your database
2. Located all the tables which have a Foreign Key based upon your problem
table's autonumber Primary Key
3. Add a new column, type Long Integer, to each of those tables.
4. Change your corrupted autonumber Primary Key to a Long Integer.
5. Add a new column, type Autonumber, to the problem table.
6. Run an Update query to each of the subsidiary tables to update the empty
column in each of those tables.
7. Rename all the old columns in all the tables.
8. Name all the new columns to the original names, and change the Primary
Key from the old key to the new autonumber key.
9. Once you are satisfied that the queries will work, you can delete the old
columns, and make sure all the indexes and relationships are recreated.
The method above works perfectly if done in the specific order shown. I've
had to do this fix 4 times, but there has not been a problem once the
service packs have been deployed.