Ok, stupid question, but where would I insert this into my query. What I gave
you was only part of the query. I'm not good with programming at all. Here is
my SQL statment I currently have:
SELECT Site.Name, Person.Number, Position.Name, Job.JobStartDate,
Job.JobEndDate, Job.JobStartTime, Job.JobEndTime, Reason.Name,
PositionGroupMembr.GroupID, SiteGroupMember.GroupID, Reason.ID,
DateDiff("d",[JobStartDate],[JobEnddate])+1 AS Days,
DateDiff("h",[JobStarttime],[JobEndtime]) AS Hours, IIf([hours]>4,"1") AS
Whole, IIf([hours]<=4,".5") AS Half, IIf([hours]<=4,".5","1") AS Type,
IIf([reason.id]=17,17,1) AS Prof, Format([jobstartdate],"dddd") AS [Start
Day], Format([jobenddate],"dddd") AS [End Day], Weekday([jobstartdate]) AS
Expr3
FROM (((PositionGroupMembr INNER JOIN [Position] ON
PositionGroupMembr.PositionID = Position.ID) INNER JOIN (((((Person INNER
JOIN Employee ON Person.ID = Employee.ID) INNER JOIN Site ON Person.SiteID =
Site.ID) INNER JOIN SiteGroupMember ON Site.ID = SiteGroupMember.SiteID)
INNER JOIN Job ON Employee.ID = Job.EmployeeID) INNER JOIN JobStatus ON
Job.Status = JobStatus.ID) ON Position.ID = Employee.PrimaryPosition) INNER
JOIN Reason ON Job.ReasonID = Reason.ID) INNER JOIN (Query11 INNER JOIN
CalendarTrack ON Query11.Name = CalendarTrack.Name) ON Employee.CalendarTrack
= CalendarTrack.ID
GROUP BY Site.Name, Person.Number, Position.Name, Job.JobStartDate,
Job.JobEndDate, Job.JobStartTime, Job.JobEndTime, Reason.Name,
PositionGroupMembr.GroupID, SiteGroupMember.GroupID, Reason.ID,
DateDiff("h",[JobStarttime],[JobEndtime]), Query11.[Hours per Day],
Query11.[Half Day Hours]
HAVING (((Job.JobStartDate)>=#8/11/2005#) AND
((Job.JobEndDate)<=#5/24/2006#) AND ((PositionGroupMembr.GroupID)=576 Or
(PositionGroupMembr.GroupID)=578) AND ((SiteGroupMember.GroupID)=175 Or
(SiteGroupMember.GroupID)=176 Or (SiteGroupMember.GroupID)=177 Or
(SiteGroupMember.GroupID)=178));
KARL DEWEY said:
I forgot to add that I also used a table named CountNumber with a field
[CountNUM] containing numbers zero through your maximum date spread.
It also fills in if the employee has not returned yet.
:
This should do it for you.
Table named [KRB Labor] and field [People] for employee.
SELECT [KRB Labor].People, Count(Format([JobStartDate]+[CountNUM],"w")) AS
[Total Mon & Fri]
FROM [KRB Labor], CountNumber
WHERE ((([JobStartDate]+[CountNUM])<=IIf([JobEnddate] Is
Null,Date(),[JobEnddate])) AND ((Format([JobStartDate]+[CountNUM],"w"))=2 Or
(Format([JobStartDate]+[CountNUM],"w"))=6))
GROUP BY [KRB Labor].People
ORDER BY [KRB Labor].People;
:
I have a query that I need to find out how many absences occured on Monday's
and Fridays. I have a JobStart date field and Jobenddate field. These fields
determine the date range that the employee was absent. I have this formula
below to get the number of days absent between the JobStart Date and
JobEnddate:
DateDiff("d",[JobStartDate],[JobEnddate])+1
So Now I have my Total number of days that the employee was absent, but now
I need to know what day of the week that those absences occured. I do not
understand on how to use VB or the modules. It would be great if you could
help me do this as a query! If I you need more detail, I will be glad to
provide.
Thanks,