Accidentally delete a row from an autonumber table

C

Chip Masarie

Yikes! I accidently deleted a row from a table that has an autonumber column.
It had ID=1. Is there anyway that I can add that row back or create a new
table that will mimic my original table. Note that my numbers are not
continuous since sometimes I deleted rows intentionally. Thanks in advance
for your help.

Chip
 
J

John Vinson

On Wed, 20 Oct 2004 10:47:02 -0700, Chip Masarie <Chip
Yikes! I accidently deleted a row from a table that has an autonumber column.
It had ID=1. Is there anyway that I can add that row back or create a new
table that will mimic my original table. Note that my numbers are not
continuous since sometimes I deleted rows intentionally. Thanks in advance
for your help.

Chip

Autonumbers AREN'T continuous, by design. If you delete a record that
record is gone forever, and so is its autonumber value.

You can create a new record in the table with any (non-duplicate)
value of the autonumber field by running an Append query from a table
with a Long Integer field in place of the autonumber value, or even an
append query using a list of values:

INSERT INTO Employees([Autonumber], [LastName], [FirstName], ...)
VALUES (1, "Baggins", "Frodo", ...)

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
T

Ted Allen

The append query that John mentioned is the only method that I have used to
add specific ID's to an Autonumber field, but if you have an old backup of
the database you may also be able to copy the record from the old table and
paste into the new. I haven't tried this, but I would guess it may work.

-Ted Allen

John Vinson said:
On Wed, 20 Oct 2004 10:47:02 -0700, Chip Masarie <Chip
Yikes! I accidently deleted a row from a table that has an autonumber column.
It had ID=1. Is there anyway that I can add that row back or create a new
table that will mimic my original table. Note that my numbers are not
continuous since sometimes I deleted rows intentionally. Thanks in advance
for your help.

Chip

Autonumbers AREN'T continuous, by design. If you delete a record that
record is gone forever, and so is its autonumber value.

You can create a new record in the table with any (non-duplicate)
value of the autonumber field by running an Append query from a table
with a Long Integer field in place of the autonumber value, or even an
append query using a list of values:

INSERT INTO Employees([Autonumber], [LastName], [FirstName], ...)
VALUES (1, "Baggins", "Frodo", ...)

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top