How to reset incrementing numbers to 0 or 1 when new date occurs?
How to reset number to 0 or 1 when new dates occurs?
Collapse
X
-
-
Assuming that you have a field which allows user to enter today's date.
You can change the [IncrementingNum ber] field to a Number data type rather than an AutoNumber data type. Then you can try this code on a Form_Load event for a new record.
I hope that helps.Code:If DMax("[DateField]", "TABLENAME") < Date Then 'Reset increment Number Me.IncrementingNumber = 0 End If If DMax("[DateField]", "TABLENAME") = Date Then 'Increment Number = Last Increment Number + 1 Me.IncrementingNumber = (DMax("[IncNum]", "TESTTABLE", "[DateField] = #" & Date & "#") + 1) End IfComment
Comment