SELECT Category.*, Year([Date]) AS CalendarYear, Month([Date]) AS CalendarMonth, IIf(Month([Date])<7,Year([Date]),Year([Date])+1) AS Fiscal_Year, MonthName([CalendarMonth],False) AS MonthName
FROM Category
WHERE (((IIf(Month([Date])<7,Year([Date]),Year([Date])+1))>=[Start Fiscal Year] And (IIf(Month([Date])<7,Year([Date]),Year([Date])+1))<=[End Fiscal Year]))
UNION
SELECT [TODD Category].*, Year([Date]) AS CalendarYear, Month([Date]) AS CalendarMonth, IIf(Month([Date])<7,Year([Date]),Year([Date])+1) AS Fiscal_Year, MonthName([CalendarMonth],False) AS MonthName
FROM [TODD Category]
WHERE (((IIf(Month([Date])<7,Year([Date]),Year([Date])+1))>=[Start Fiscal Year] And (IIf(Month([Date])<7,Year([Date]),Year([Date])+1))<=[End Fiscal Year]))
ORDER BY 8;
That worked, Thank you. Can I ask why you put ORDER BY with an 8?Try replacing the current SQL code with this:
Rich (BB code):SELECT Category.*, Year([Date]) AS CalendarYear, Month([Date]) AS CalendarMonth, IIf(Month([Date])<7,Year([Date]),Year([Date])+1) AS Fiscal_Year, MonthName([CalendarMonth],False) AS MonthName FROM Category WHERE (((IIf(Month([Date])<7,Year([Date]),Year([Date])+1))>=[Start Fiscal Year] And (IIf(Month([Date])<7,Year([Date]),Year([Date])+1))<=[End Fiscal Year])) UNION SELECT [TODD Category].*, Year([Date]) AS CalendarYear, Month([Date]) AS CalendarMonth, IIf(Month([Date])<7,Year([Date]),Year([Date])+1) AS Fiscal_Year, MonthName([CalendarMonth],False) AS MonthName FROM [TODD Category] WHERE (((IIf(Month([Date])<7,Year([Date]),Year([Date])+1))>=[Start Fiscal Year] And (IIf(Month([Date])<7,Year([Date]),Year([Date])+1))<=[End Fiscal Year])) ORDER BY 8;