>Thanks, but same problem. However you mark the last number used is still dependent upon that record being updated (committed). Dallas
>-----------------
>
>Have a table with the sequence numbers. Have a function that looks up the last number used, increments it, and returns the incremented value. For security, lock the record while it is incremented.
For primary keys, which the user doesn't sees, it doesn't matter if numers are skipped.
For automatically incremented document numbers, you should assign the number (from the table of sequence numbers) only when the record is saved. Explain to the users that this is related to the fact that they are using a multi-user system, and that you don't know whether they will actually save a record.
Also, embed everything within a transaction. If the record can't be saved, roll the transaction back. All tables involved, including the table of sequence numbers, must be part of a database, so that they can participate in a transaction.
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)