Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOLD LAST VALUE USED

Status
Not open for further replies.

novice24

Technical User
Jun 20, 2001
17
0
0
US
Hello,

Here is my situation. I have a user input form that is capturing data via text boxes. One of the fields is a Document Number. Format of the document number contains 4 numeric digits at the end,(i.e. a Serial Number) (which increments 1 every time a document is created). Everything works fine, EXCEPT... I want to store the last Serial Number used prior to the form being closed.

I would like it to store in a text box or label, so that the next time the form is opened the Serial Number can default to this Serial Number + 1. I can set up a way to do it by passing the value to a temporary table on exit, and pulling it back on open; but I would like to keep all the data necessary on this one form.
 
No need to hold.

Just uses DMAX function to get then last value,

dmax("right(Serial_Number ,4)","SampleData").

But i would suggest, if your app is a multi-user, it is not wise to put the "Serial Number + 1" as default the next time the form is open. It will give you trouble when two user are creating record at almost the same time..... better generate the Serial Number just before the actual creation of the record.. just a taut....

cheers,
ega


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top