Report number calculated based on date

jon98548

Registered User.
Local time
Today, 17:33
Joined
Feb 14, 2003
Messages
141
I have a form that users use to input new report information (tblLog). Each entry has a 8-digit report number (PK) based on the following convention, given 12345678 as a hypothetical report number:

|12| = the site code
|34| = current year
|5678| = next report in sequence from 0001 - 9999

Up to this point I had a query (qryCount) that searched the log of these entries and counted reports for the current year based on 1234*. Now, on the input form I use the following code to display the next report number for the user:

="The next report number for MySite is: " & 40000000+DCount("ReportNumber","qryCount")+1+(Format(Date(),"yy")*10000)

So if I write the fifth report of this year, the number should look like this: 40040005. Which all this works great. The problem is every year I have to change my query to count the current year.

I have started a change in the code, but need some help with the criteria. I know it has to look for my specific site criteria and the date criteria.

="The next report number for MySite is: " & 40000000+DCount("ReportNumber","tblLog",SomeCriteria)+1+(Format(Date(),"yy")*10000)

Any ideas? Like I say what I have now works, but this would cut off some easily forgettable maintenance.
 

Users who are viewing this thread

Back
Top Bottom