A
ablatnik via AccessMonster.com
A little help please. I have a Master Report that totals all reports for a
full year. Below is the SQL statement written for the month of January...
SELECT Department.Department, (SELECT COUNT([Work Orders].ID_Numbers) FROM
[Work Orders] WHERE [Work Orders].Department = Department.Department_ID AND
Year([Date Opened]) = Year(Now()) And DatePart("m", [Date Opened]) = 1) AS
[Issued for Year], (SELECT COUNT([Work Orders].ID_Numbers) FROM [Work Orders]
WHERE [Work Orders].Department = Department.Department_ID AND Year([Date
Opened]) = Year(Now()) And DatePart("m", [Date Opened]) = 1) AS [Issued for
January], (SELECT COUNT([Work Orders].ID_Numbers) FROM [Work Orders] WHERE
[Work Orders].Department = Department.Department_ID AND [Work Orders].Status
IN (1,5,6,8) AND Year([Date Opened]) = Year(Now()) And DatePart("m", [Date
Opened]) = 1) AS [Total Active W/Requests]
FROM Department;
This Statement works for January only. I can't just change the month cause
come February, I need the column "Issued for Year" to have the total work
orders for January & February...then March will be added to the list...then
April etc...
Can anybody assist me with this?
full year. Below is the SQL statement written for the month of January...
SELECT Department.Department, (SELECT COUNT([Work Orders].ID_Numbers) FROM
[Work Orders] WHERE [Work Orders].Department = Department.Department_ID AND
Year([Date Opened]) = Year(Now()) And DatePart("m", [Date Opened]) = 1) AS
[Issued for Year], (SELECT COUNT([Work Orders].ID_Numbers) FROM [Work Orders]
WHERE [Work Orders].Department = Department.Department_ID AND Year([Date
Opened]) = Year(Now()) And DatePart("m", [Date Opened]) = 1) AS [Issued for
January], (SELECT COUNT([Work Orders].ID_Numbers) FROM [Work Orders] WHERE
[Work Orders].Department = Department.Department_ID AND [Work Orders].Status
IN (1,5,6,8) AND Year([Date Opened]) = Year(Now()) And DatePart("m", [Date
Opened]) = 1) AS [Total Active W/Requests]
FROM Department;
This Statement works for January only. I can't just change the month cause
come February, I need the column "Issued for Year" to have the total work
orders for January & February...then March will be added to the list...then
April etc...
Can anybody assist me with this?