>I see Hilmar has given you a lot of information. Just as an aside, you should never ever get a duplicate primary key. A primary key should be a surrogate key in that it has no business meaning and so the system should be generating the keys for you (whether your own generation code or an Autoinc field).
I like to program this way too, but opinions seem to be quite divided on this issue. My article on PKs shows how to assign a sequential primary key. VFP 9 has the auto-incremental field, but I would probably prefer to continue using my own SerialNumber() (we are still using VFP 6, sigh).
I should add that with sequential numbers as primary keys. the primary key will never have duplicates. But the candidate keys can very well have duplicates, and VFP checks among deleted records. So - when using this design philosophy - a candidate index should be filtered on
not deleted(). Thus, the user can delete a record and re-create a record with the same PK.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)