Click here to Skip to main content
15,878,953 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to use the deleted keys which are generated in the forms using auto increment in ms access..
How can i achieve it?
For ex if i have records with pk 1-5 and i delete 3rd record i want the next record pk to start from 3 ...as well as if i insert a record after a user defined record i want the remaining keys to follow the same fashion...

Kindly reply
Posted

1 solution

That is a very, very bad idea - you can do it, but it can cause all sorts of problems. For example, what if you get a new record request from two different users at the same time? They could both decide to use an id of "3" with the identification problems that that will cause.
If you really want a sequential number for records, then don't use the record ID - keep that as a separate object - and use the ordinal number instead.
 
Share this answer
 
Comments
gaurish thakkar 5-Jun-12 3:39am    
ya i got what you meant to say...i have 3 fields now 1 which is id for that table and 2 others for the sequencing of records...

But i still don't know how to maintain the sequence if a particular record is deleted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900