Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
P.O. number generator
Message
From
17/11/1999 10:54:14
 
 
To
17/11/1999 10:22:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00291890
Message ID:
00291914
Views:
15
>I need to write a little code that generates a number that equals the last number plus one each time a new record is appended, and writes it to a field in that record when the save button is pressed. It should cancel the number if an exit w/out save is executed.
>


Most of us use a strategy similar to this for generating primary keys. the key concept is to store the next available key in a table, and call a procedure that opens the table, locks the record, increments by one, and returns the value. Check out the Tastrade sample that ships with VFP for an idea on how to set this up. (Look in the stored procedures for the database).

YOu would just need to throw in some additional logic that resets the value at the beginning of the year.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform