This will resolve your immediate problem, but it will keep happening to you every time you delete a record. The autonumber field keeps track of each number it uses in increments of 1 generally, and will not reuse a number it has used already, regardless of whether the record has been deleted or not. It would be programatically difficult to renumber all of your PK's everytime you deleted a record, although referential integrity could be maintained (cascaded updates).
If you need to use the autonumber field to tell you how many records are in your table, you should consider a query to do this for you. i use a query to tell me the number of active records in some of my databases (I don't delete records usually, just select a "retired" check box.)
Other than personal issues, however, I can't think of a reason to change the non-meaningful PK every time a record is removed (yes, non-meaningful as opposed to meaningless.) Is there a compelling design reason for this? Perhaps there is another solution.
mmcdonal
|