I'm a beginner with Access and am using the 2007 version on XP. I've created a database that keeps track of employee hours where I work. Everything has worked fine until we recently hired someone new. I have a subquery that checks for the amount of overtime hours someone has between a specified date range, and the new employee doesn't show up at all. I'm thinking it's because no hours information has been entered in because he was new, so the query is returning a null value or something. I've tried to use an iif statement so that if it's null it returns a zero but that didn't work; however, I may have not had proper syntax or something. Anyway, here's the query:
If anyone can help me figure out a way to return all employees regardless if they have hours information or not it would really help. All I need it to say is zero for them if there's nothing there. The new employee shows up at later dates when the information is there but not when he barely started.
Thanks!
Code:
SELECT [Overtime Hours Query].EmployeeID, Employees.LastName, Employees.FirstName, Sum([Overtime Hours Query].TotalOTHoursWk) AS TotalOTHoursPP FROM Employees LEFT JOIN [Overtime Hours Query] ON Employees.ID=[Overtime Hours Query].EmployeeID WHERE ((([Overtime Hours Query].LastWeekDay) Between [Forms]![Date Range].[StartDate] And [Forms]![Date Range].[EndDate])) GROUP BY [Overtime Hours Query].EmployeeID, Employees.LastName, Employees.FirstName ORDER BY Employees.LastName, Employees.FirstName;
Thanks!
Comment