restore autonumber records

S

S.Low

A number of records were deleted from the employee table
in my database. The key was an autonumber field that is
also a forgien key in two other tables. I do not have a
backup tape from before the deletions, however I do have a
printed list. How do I put this information back and
restore the relationships?
Thanks
S.Low
PS Moral of story: Not even spouses should be allowed the
admin password.
 
D

Douglas J. Steele

I'm not 100% certain this will work, but try creating a new table that's
identical to your employee table, with the except that you have a Long
Integer instead of the Autonumber. Add the missing records to that new
table. Use an append query to copy the records from the new table to the
actual Employee table (including mapping the Long Integer field to the
Autonumber field)

Don't forget to make a copy of your database before you try this, just in
case!
 
S

S.Low

It worked! I did not think it would,sounded to easy, so I
didn't try.
Thanks. Now for my next question, how guilty to I make
her feel?

Thanks Again
SLow
 
J

John Vinson

It worked! I did not think it would,sounded to easy, so I
didn't try.
Thanks. Now for my next question, how guilty to I make
her feel?

I'd have made her type in all the missing records, and proofread them.
 
T

Tim Ferguson

A number of records were deleted from the employee table
in my database. The key was an autonumber field that is
also a forgien key in two other tables.

And next time, ENFORCE REFERENTIAL INTEGRITY on those foreign keys. That is
the whole point of relationships, that they are there to forbid deletions
like that.

Unless of course, you were mad enough to switch on Cascade Deletions, which
would make an accident into a disaster.


Best wishes


Tim F
 
B

Bill Schulz

There is something out there that you can use to alter the
numbers. The syntax is as below. As I'm not an expert,
this may not help you:

ALTER TABLE tblOrder Alter Column OrderId COUNTER (1, 1)
The first number in parens is the seed, or starting
number, the second number is the incrementing number. In
other words, if you want to start at 1000 and increment by
10 (1000, 1010, 1020...) you would use (1000, 10)

Hope this is helpful

This will modify the seed and increment value for an
existing AUTONUMBER colunm..
 

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