I am trying to use the below code to count the number of files in a year, so that each time I add a new file (by adding the reported date) the database will allocate the next number in sequence.
Private Sub ReceiveDate_AfterUpdate()
Me.YearID = DatePart("yyyy", [ReceiveDate])
Me!LocalFileID = Nz(DMax("[LocalFileID]", "tblCrashFile", "[YearID]=" & Me.YearID), 0) + 1
Me.LocalNumber = [LocalFileID] & "/" & [YearID]
Me.CrashRecordsDate = Now()
End Sub
My problem is that when I reach 10, all the new files following remain at 10, so I end up with a lot of 10/2005 files.
Can someone help?
Private Sub ReceiveDate_AfterUpdate()
Me.YearID = DatePart("yyyy", [ReceiveDate])
Me!LocalFileID = Nz(DMax("[LocalFileID]", "tblCrashFile", "[YearID]=" & Me.YearID), 0) + 1
Me.LocalNumber = [LocalFileID] & "/" & [YearID]
Me.CrashRecordsDate = Now()
End Sub
My problem is that when I reach 10, all the new files following remain at 10, so I end up with a lot of 10/2005 files.
Can someone help?