Hello everyone.
I have a list of employees in a table called tblReport. In this table I have four fields.
Id autonumber
Name text
StartDate date/time
TermDate date/time
I have a second table called tblBillableMonth which has two fields
Id autonumber
DateID date/time
The DateID contains a list of dates from 1/2000 to 2/2006
01/2000
02/2000
03/2000
02/2006
What I am trying to do (very unsuccessfully) is to count
the number of employees by DateID so that I can show the
number of billable employees we have each month.
I created the following query (qryBillabel) to extract the
data I need. Unfortunately it is skipping the very first
month for each employees date range. For example, if
employee Joe Smith has a Start Date of 2/3/2000 and a Term
Date of 3/6/2003 the query creates a row for 3/2000,
4/2000, etc. but not 2/2000.
I have change the tblBillableMonth date fields to a format
of mm/yyyy, thinking this would do the trick. However I
get the same result. That is the first month is not
counted.
Query Name = qryBillabel
The ultimate goal is to take the query above and then run a crosstab query to display the results.
Query Name = qryBillabel_Crosstab
I can sure use some query help on this one or suggestions
on a better way to do what I am trying to accomplish.
Thanks
Dom
I have a list of employees in a table called tblReport. In this table I have four fields.
Id autonumber
Name text
StartDate date/time
TermDate date/time
I have a second table called tblBillableMonth which has two fields
Id autonumber
DateID date/time
The DateID contains a list of dates from 1/2000 to 2/2006
01/2000
02/2000
03/2000
02/2006
What I am trying to do (very unsuccessfully) is to count
the number of employees by DateID so that I can show the
number of billable employees we have each month.
I created the following query (qryBillabel) to extract the
data I need. Unfortunately it is skipping the very first
month for each employees date range. For example, if
employee Joe Smith has a Start Date of 2/3/2000 and a Term
Date of 3/6/2003 the query creates a row for 3/2000,
4/2000, etc. but not 2/2000.
I have change the tblBillableMonth date fields to a format
of mm/yyyy, thinking this would do the trick. However I
get the same result. That is the first month is not
counted.
Query Name = qryBillabel
Code:
SELECT tblBillableMonth.DateID AS MonthToMark, tblReport.StartDate, tblReport.TermDate, tblReport.NAME
FROM tblBillableMonth, tblReport
WHERE (((tblBillableMonth.DateID) Between [StartDate] And [TermDate]));
The ultimate goal is to take the query above and then run a crosstab query to display the results.
Query Name = qryBillabel_Crosstab
Code:
TRANSFORM Count(qryBillabel.NAME) AS CountOfNAME
SELECT qryBillabel.MonthToMark, Count(qryBillabel.NAME) AS [Total Of NAME]
FROM qryBillabel
GROUP BY qryBillabel.MonthToMark
PIVOT Format([MonthToMark],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
I can sure use some query help on this one or suggestions
on a better way to do what I am trying to accomplish.
Thanks
Dom