Expand|Select|Wrap|Line Numbers
- Dim strCurrentFiscalYear As String
- strCurrentFiscalYear = DLookup("[CurrentFiscalYear]", "YearReset", "[ID] = 1")
- Dim strLastFiscalYear As String
- strLastFiscalYear = strCurrentFiscalYear - 1
- strNewRecordNumber = DMax("[RecordNumber]", "TblDocket", "[FiscalYear] = strLastFiscalYear") + 1
What I am trying to accomplish is that for instance that the current fiscal year is 2009 saved in table named YearReset, in the field CurrentFiscalYear. When a user tries to enter a record for the last fiscal year - 2008, the dmax is or should look in the database table TblDocket, find the largest RecordNumber of the record that the Fiscalyear equals 2008.
I can get it to work if I would just put 2008 where strLastFiscalYear is but that would not help for next years.
Any suggestions? Thanks again.