jwcolby54
Member
- Local time
- Today, 11:39
- Joined
- May 19, 2025
- Messages
- 265
It can be done. I have done it. It is not particularly useful, and you probably don't want to go doing that. Except in one case...I had not known you could insert an Autonumber between two other values. For instance if you have five records with values 1-5 and delete the 3 record, I wasn’t aware you could insert a record with 3 as the autonumber. I would appreciate if some could provide a small database with a demo of how this is done.
Suppose that you archive records in a table, keeping the PK out in the archive (which you BETTER do!). Then you delete the original records in the original table. Now someone comes along and tells you that you need to recover those records back into the original table.
No problem says I, write a select query to grab the specific records including the autonumber pk. Then use that source query to append those records back into the original table including the pk.
Voila, you have just inserted records back into the "hole" and the same original PKs are valid in the child records, which you are almost certainly also recovering into their respective tables, which also created "holes" as you archived them.
What you will need to do however is tell the autonumber to pick up after the LAST NUMBER in the PK field. If you do not do that the autonumber code will continue filling in the hole with autonumbers. But the holes "belong" to other archived records.