Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recreate accidentally deleted record

Status
Not open for further replies.

mrkan

Programmer
Oct 30, 2006
39
US
I have a table with field pkID which is type AutoNumber.
pkID is my primary key.

I accidentally removed one record (pkID = 57) and now I am trying to put it back. How can I do that. I need to insert exact same pkID into my table.
I tried temporary to change definition from AutoNumber to Integer, but because of relationship I wasn't allowed to do so. (and I am not willing to remove relationships and recreate them again)

thanks
 
how about just write the query in SQL:

Code:
INSERT INTO TableName (pkID, fieldname1, fieldname2) values (57, field1value, field2value)

Leslie

In an open world there's no need for windows and gates
 
As far as I know this sql statement would produce an error.
pkID is automatically generated and can't be populated.

I think there is a way to override that, but not sure how.
 
Did you try changing the field to Number, inserting the record and the changing the field back to Auto Number?
 
MRkan:

Did you try lespaul's method if your database is a access db
(not a Sql backend ) it works
 
I have successfully imported the deleted record from a backup copy. You'll need to import it to a dummy table first, then append into your live table. Worked fine for even a non-programmer using the visual approach. My sympathies, I've been there in the days shortly before we created our permissions setup. Good luck!

Susan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top