I have a form that I use to autogenerate a new projectid that has the format of: currentdate which is yyyymmdd & sequencenum. Example: 20081024-1
Below is the code I have on the current event of the form:
Private Sub Form_Current()
If Me.NewRecord Then
Me.project_sequ encenum = DMax("project_s equencenum", "tblproject s") + 1
End If
Me.txtdateseque nce = Me.project_date & "-" & Me.project_sequ encenum
Me.txtdateseque nce = Format(Me.proje ct_date, "yyyymmdd") & "-" & Me.project_sequ encenum
End Sub
The problem I am having is that the sequencenum automatically increments, but does not reset to 1 for the first projectid I create on a new date.
How do I have the sequencenum reset to 1 when a new date occurs so that the first projectid created starts with the sequencenum of 1?
Thanks,
Below is the code I have on the current event of the form:
Private Sub Form_Current()
If Me.NewRecord Then
Me.project_sequ encenum = DMax("project_s equencenum", "tblproject s") + 1
End If
Me.txtdateseque nce = Me.project_date & "-" & Me.project_sequ encenum
Me.txtdateseque nce = Format(Me.proje ct_date, "yyyymmdd") & "-" & Me.project_sequ encenum
End Sub
The problem I am having is that the sequencenum automatically increments, but does not reset to 1 for the first projectid I create on a new date.
How do I have the sequencenum reset to 1 when a new date occurs so that the first projectid created starts with the sequencenum of 1?
Thanks,
Comment