I am making a request form with a uniqe FORM NO. in order to recall the data faster. The FORM NO. is formated as follows, yyyyMMdd-000 the 000 will be incremented for every transaction made that's easy... but the problem is how to reset it back to 000 the following day?

example:

20110713-000 (for the first transaction)
20110713-001 (for the second transaction)
20110713-002 (for the third transaction)
.
. (and so on)
.
20110713-999

then the following day, the number should go back to 000

20110714-000
.
.
.
20110714-999

any suggestion?
with out reseting it manually

I'm not sure why you are assuming that there would only be 1000 submissions per day? Any reason for limiting the last part to 3 digits/characters? Any reason to not try out a pattern like "yyyyMMdd-HHmmssS" which automatically handles the resetting for you?

you could store the day in a file and then when you run the program it checks todays date and compares it with the date in the file. if they are different then it starts a new set, however if they are the same then you read off the last transaction number (from a file again) and then continue adding from there.

you could store the day in a file and then when you run the program it checks todays date and compares it with the date in the file. if they are different then it starts a new set, however if they are the same then you read off the last transaction number (from a file again) and then continue adding from there.

oh yeah... how come i didn't think of that... thanks!

I'm not sure why you are assuming that there would only be 1000 submissions per day? Any reason for limiting the last part to 3 digits/characters? Any reason to not try out a pattern like "yyyyMMdd-HHmmssS" which automatically handles the resetting for you?

What i am making is just for a small department and for small transactions. My supervisor told me it would not reach 100 transaction per day. but thanks for the time idea though.

My supervisor told me it would not reach 100 transaction per day.

I wish I had a dollar for every time a user told me "x will never happen" and then it did, after I shipped the code. Let's hope, for your code's sake, that your supervisor's business doesn't take off and become a big success.

This question has already been answered. Start a new discussion instead.