C
CevinMoses
Having problems working with fiscal year data since our fiscal year starts
October 1st, not January 1st. Therefore FY05 (Fiscal Year 2005) actually
started during calendar year 2004 (October 1, 2004). Here's my problem:
I need to create a query to return a list of all personnel who have not
attended a particular training event (Called "CTT" for short) since the
beginning of the fiscal year. I can write a query right now to return
everyone whose [personnel information].[CTT] < 01-Oct-04 (where [personnel
information] is the table and [CTT] is the field holding the date they
received the training). The hard part is making it use the year I want it to
automatically.
For any date in October, November, or December, I want to use 01-Oct of the
current year, so 01-Oct-04 above could be replaced with the following:
DateSerial(Year(Now()),10,1)
However, for any date From January through September, The year needs to be
adjusted to the year prior, so I could replace 01-Oct-04 with:
DateSerial(Year(Now())-1,10,1)
How can I write a conditional into the query to check which formula to use,
or is there a cleaner way? (There always is!)
Query's currently defined as:
SELECT [Personnel Information].[LAST NAME], [Personnel Information].[FIRST
NAME], [Personnel Information].CTT
FROM [Personnel Information]
GROUP BY [Personnel Information].[LAST NAME], [Personnel Information].[FIRST
NAME], [Personnel Information].RANK, [Personnel Information].CTT
HAVING ((([Personnel Information].CTT)<DateSerial(Year(Now())-1,10,1))) OR
((([Personnel Information].CTT) Is Null))
ORDER BY [Personnel Information].[LAST NAME], [Personnel Information].[FIRST
NAME];
October 1st, not January 1st. Therefore FY05 (Fiscal Year 2005) actually
started during calendar year 2004 (October 1, 2004). Here's my problem:
I need to create a query to return a list of all personnel who have not
attended a particular training event (Called "CTT" for short) since the
beginning of the fiscal year. I can write a query right now to return
everyone whose [personnel information].[CTT] < 01-Oct-04 (where [personnel
information] is the table and [CTT] is the field holding the date they
received the training). The hard part is making it use the year I want it to
automatically.
For any date in October, November, or December, I want to use 01-Oct of the
current year, so 01-Oct-04 above could be replaced with the following:
DateSerial(Year(Now()),10,1)
However, for any date From January through September, The year needs to be
adjusted to the year prior, so I could replace 01-Oct-04 with:
DateSerial(Year(Now())-1,10,1)
How can I write a conditional into the query to check which formula to use,
or is there a cleaner way? (There always is!)
Query's currently defined as:
SELECT [Personnel Information].[LAST NAME], [Personnel Information].[FIRST
NAME], [Personnel Information].CTT
FROM [Personnel Information]
GROUP BY [Personnel Information].[LAST NAME], [Personnel Information].[FIRST
NAME], [Personnel Information].RANK, [Personnel Information].CTT
HAVING ((([Personnel Information].CTT)<DateSerial(Year(Now())-1,10,1))) OR
((([Personnel Information].CTT) Is Null))
ORDER BY [Personnel Information].[LAST NAME], [Personnel Information].[FIRST
NAME];