S
Secret Squirrel
I have a table "tblWorkdaysCalendar" that lists all the work days for
2008-2011. I'm trying to count the number of workdays for 2009 YTD through
the last full month. How can I do that in my query? Right now if I select
just a year from my form it gives me all the workdays for that given year. If
I choose a month and year then I get just that month. The month & year
seleciton together works fine and returns just that month's workdays but I
can't figure out how to count workdays YTD through the last full month. Any
help would be greatly appreciated.
SELECT Count(WorkdaysCalendar.CalDate) AS CountOfCalDate,
Format([CalDate],"mmmm") AS Months, Format([CalDate],"yyyy") AS Years
FROM WorkdaysCalendar
GROUP BY Format([CalDate],"mmmm"), Format([CalDate],"yyyy")
HAVING
(((Format([CalDate],"mmmm"))=[Forms]![frmSelectAbsenteeism]![cboMonth]) AND
((Format([CalDate],"yyyy"))=[Forms]![frmSelectAbsenteeism]![cboYear])) OR
(((Format([CalDate],"yyyy"))=[Forms]![frmSelectAbsenteeism]![cboYear]) AND
(([Forms]![frmSelectAbsenteeism]![cboMonth]) Is Null));
Thanks
SS
2008-2011. I'm trying to count the number of workdays for 2009 YTD through
the last full month. How can I do that in my query? Right now if I select
just a year from my form it gives me all the workdays for that given year. If
I choose a month and year then I get just that month. The month & year
seleciton together works fine and returns just that month's workdays but I
can't figure out how to count workdays YTD through the last full month. Any
help would be greatly appreciated.
SELECT Count(WorkdaysCalendar.CalDate) AS CountOfCalDate,
Format([CalDate],"mmmm") AS Months, Format([CalDate],"yyyy") AS Years
FROM WorkdaysCalendar
GROUP BY Format([CalDate],"mmmm"), Format([CalDate],"yyyy")
HAVING
(((Format([CalDate],"mmmm"))=[Forms]![frmSelectAbsenteeism]![cboMonth]) AND
((Format([CalDate],"yyyy"))=[Forms]![frmSelectAbsenteeism]![cboYear])) OR
(((Format([CalDate],"yyyy"))=[Forms]![frmSelectAbsenteeism]![cboYear]) AND
(([Forms]![frmSelectAbsenteeism]![cboMonth]) Is Null));
Thanks
SS