Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatic record numbering
Message
From
23/03/2005 17:06:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00996535
Message ID:
00998668
Views:
21
>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform