I have built a database to store case files. The case number is automatically assigned starting at number 1 on January 1. I use this code to get my next sequential case number when I click to save the record:
Me!txtCASE_NUMBER = DMax("CASE_NUMBER", "tblCaseDetail") + 1
MsgBox "Your Case Number is " & Chr(13) & Me![txtCASE_NUMBER], vbOKOnly
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
This works just fine incrementing the CASE_NUMBER by 1. My problem is what happens when I start at a new year with #1 again? I want to find the current year which would be DMax("CASE_YEAR", "tblCaseDetail") and DMax("CASE_NUMBER", "tblCaseDetail") and increment that CASE_NUMBER by 1.
I guess my question is this, can I do multiple DMax's in one statement?
THanks,
Mark
Me!txtCASE_NUMBER = DMax("CASE_NUMBER", "tblCaseDetail") + 1
MsgBox "Your Case Number is " & Chr(13) & Me![txtCASE_NUMBER], vbOKOnly
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
This works just fine incrementing the CASE_NUMBER by 1. My problem is what happens when I start at a new year with #1 again? I want to find the current year which would be DMax("CASE_YEAR", "tblCaseDetail") and DMax("CASE_NUMBER", "tblCaseDetail") and increment that CASE_NUMBER by 1.
I guess my question is this, can I do multiple DMax's in one statement?
THanks,
Mark