> I have a situation where I need to put back in a deleted record to a
table whose primary key is an Autonumber. And of course the autonumber
has to match what it was before. Any way of saving my butt on this one?
If you have 5 records autonumbered 1 thru 5, and you've deleted #5, you
could compact and close and re-enter the record. The new record should be
assigned autonumber 5.
But more likely you have thousands of records which are not autonumbered
sequentially and the one deleted was somewhere in the middle. If that's the
case, I'd be surprised if you find a way to get the record back in with the
same autonumber. Obviously, you'd be better off using something else as
unique identifier. Autonumber is a great choice for a primary key because
it's a single field, static identifier. But it's a poor choice if it makes
any difference what that number is.
If you want a unique, sequential identifier, there are ways to do it, e.g.
DMax("AcctNum", "tblAccts") + 1. But I'd still use Autonumber as a primary
key.