Generate new number on new year!

DeepTrouble

Registered User.
Local time
Today, 23:58
Joined
Apr 24, 2001
Messages
18
I am generating a record number for each record with an expression as follows
Dim numZero As Integer
Dim strZero As String
numZero = 6 - Len(CStr(Me![Autonumber].Value))
strZero = String(numZero, "00001")
Me![Specimen Number].Value = str(Right(Year(DATE), 2)) + "-" + strZero + cstr(Me![Autonumber].Value)
This generates a new number for each specimen (we are a clinical lab). However, I would like to start Specimen number with 000001 on First Jan for each year, which is not the case at present.
Thanks a lot for your time and suggestion.
 
Change it to look for the MAX number for the current year and add one to that for a new number. If it does not find one for the current year, set it to 1 (first one for the year).
 

Users who are viewing this thread

Back
Top Bottom