thanks,
I want to write two queries and display the results of the second query.
thesehours is the number of hours that my function returns based on fields
in a dialog box.
I want to use these hours in a query to determine if an employee can add
[thesehours] to their schedule without going over 40 hours. Then I need to
run another query to find which employee (of the set of employees that was
returned by the first query, has the specific hours/days available to work.
thesehours = CalcHours(Me!txtEnd.Value - Me!txtStart.Value,
Me!chkMonday.Value, Me!chkTuesday.Value, Me!chkWednesday.Value,
Me!chkThursday.Value, Me!chkFriday.Value, Me!chkSaturday.Value,
Me!chkSunday.Value, Me!chkEveryOther.Value)
SELECT Employee![EMP Last Name] & ", " & Employee![EMP First Name] & " " &
Employee![EMP Middle Name] AS Employee, Sum(CalcHours([SCH End Time]-[SCH
Start Time],[SCH Monday],[SCH Tuesday],[SCH Wednesday],[SCH Thursday],[SCH
Friday],[SCH Saturday],[SCH Sunday],Schedule![SCH EveryOtherWeekend])) AS
Hours, Employee.[EMP-PK Emp ID]
FROM Employee INNER JOIN Schedule ON Employee.[EMP-PK Emp ID] =
Schedule.[SCH-FK Emp ID]
GROUP BY Employee![EMP Last Name] & ", " & Employee![EMP First Name] & " " &
Employee![EMP Middle Name], Employee.[EMP-PK Emp ID], Schedule.[SCH Calculate
Emp Hours]
HAVING (((Schedule.[SCH Calculate Emp Hours])=Yes) AND ((Sum(CalcHours([SCH
End Time]-[SCH Start Time],[SCH Monday],[SCH Tuesday],[SCH Wednesday],[SCH
Thursday],[SCH Friday],[SCH Saturday],[SCH Sunday],[Schedule]![SCH
EveryOtherWeekend]))+[thesehours])<=40))
ORDER BY Employee![EMP Last Name] & ", " & Employee![EMP First Name] & " " &
Employee![EMP Middle Name];