I have a query that searches a worker's general availability as stated in the availability table. This is when worker's are available to work. then I link that to the schedule table. I want to see what workers are not already scheduled during a particular time frame that day.
The first query is: BaseAvailqry:
SELECT [Worker table].WorkerID, [Worker table].WorkStatusID, [Worker table].LastName, [Worker table].FirstName, [Worker table].Middle, [Worker table].CityID, [Worker table].Phone1, [Job Description].JobDesc, [Job Description].State, Availability.DaysID, Availability.Begin, Availability.End
FROM ([Job Description] INNER JOIN [Worker table] ON [Job Description].WorkerID = [Worker table].WorkerID) INNER JOIN Availability ON [Worker table].WorkerID = Availability.WorkerID
WHERE ((([Worker table].WorkStatusID)=1) AND (([Worker table].CityID)=[Forms]![SchedSearchList]![ComboCity]) AND (([Job Description].JobDesc)=[Forms]![SchedSearchList]![ComboJob]) AND (([Job Description].State)=[Forms]![SchedSearchList]![State]) AND ((Availability.DaysID)=[Forms]![SchedSearchList]![ComboDay]) AND ((Availability.Begin)>=[Forms]![SchedSearchList]![StartTime]) AND ((Availability.End)<=[Forms]![SchedSearchList]![EndTime]));
Then I link that to SchedAvailqry:
SELECT BaseAvailqry.WorkerID, BaseAvailqry.WorkStatusID, BaseAvailqry.LastName, BaseAvailqry.FirstName, BaseAvailqry.Middle, BaseAvailqry.CityID, BaseAvailqry.Phone1, BaseAvailqry.JobDesc, BaseAvailqry.State, Schedule1.Date, Schedule1.Day, Schedule1.Start, Schedule1.End
FROM Schedule1 INNER JOIN BaseAvailqry ON Schedule1.WorkerID = BaseAvailqry.WorkerID
WHERE (((Schedule1.Date)<>[Forms]![SchedSearchList]![Date]) AND ((Schedule1.Day)<>[Forms]![SchedSearchList]![ComboDay]));
This is a mindbender for me. What expression can I use to put in the Start and End fields to return people who are not scheduled during this time?
Any help would be appreciated, Thanks
The first query is: BaseAvailqry:
SELECT [Worker table].WorkerID, [Worker table].WorkStatusID, [Worker table].LastName, [Worker table].FirstName, [Worker table].Middle, [Worker table].CityID, [Worker table].Phone1, [Job Description].JobDesc, [Job Description].State, Availability.DaysID, Availability.Begin, Availability.End
FROM ([Job Description] INNER JOIN [Worker table] ON [Job Description].WorkerID = [Worker table].WorkerID) INNER JOIN Availability ON [Worker table].WorkerID = Availability.WorkerID
WHERE ((([Worker table].WorkStatusID)=1) AND (([Worker table].CityID)=[Forms]![SchedSearchList]![ComboCity]) AND (([Job Description].JobDesc)=[Forms]![SchedSearchList]![ComboJob]) AND (([Job Description].State)=[Forms]![SchedSearchList]![State]) AND ((Availability.DaysID)=[Forms]![SchedSearchList]![ComboDay]) AND ((Availability.Begin)>=[Forms]![SchedSearchList]![StartTime]) AND ((Availability.End)<=[Forms]![SchedSearchList]![EndTime]));
Then I link that to SchedAvailqry:
SELECT BaseAvailqry.WorkerID, BaseAvailqry.WorkStatusID, BaseAvailqry.LastName, BaseAvailqry.FirstName, BaseAvailqry.Middle, BaseAvailqry.CityID, BaseAvailqry.Phone1, BaseAvailqry.JobDesc, BaseAvailqry.State, Schedule1.Date, Schedule1.Day, Schedule1.Start, Schedule1.End
FROM Schedule1 INNER JOIN BaseAvailqry ON Schedule1.WorkerID = BaseAvailqry.WorkerID
WHERE (((Schedule1.Date)<>[Forms]![SchedSearchList]![Date]) AND ((Schedule1.Day)<>[Forms]![SchedSearchList]![ComboDay]));
This is a mindbender for me. What expression can I use to put in the Start and End fields to return people who are not scheduled during this time?
Any help would be appreciated, Thanks