Currently the sql for my query is:
SELECT Workorders.WorkorderID, Workorders.[Date:], Workorders.[Customer:], Workorders.[Signal Locations:], Workorders.[School Flashers:], Workorders.[Flasher Locations:], Sum([workorders empdetails]![Emp 1 Hours:]*[Employees]![PayRatew/Benefits]) AS [Totalreg Labor], Workorders.[Time Arrived:], Workorders.[Time Completed:], CInt(CDbl(Nz([Time Arrived:])*24*60)) AS minin, CInt(CDbl(Nz([Time Completed:])*24*60)) AS minout, [minout]-[minin] AS totmin, IIf([minin]=0 Or [minout]=0,[totmin]=0,[totmin]) AS minutes, IIf([minutes]<0,[minutes]=0,[minutes]) AS allmin, ([allmin]/60) AS hours, Sum([workorders empdetails]![Emp 1 OT]*[Employees]![OvertimeRatew/Benefits]) AS [Totalot Labor], [Totalreg Labor]+[Totalot Labor] AS [Total Labor], Workorders.[Work Activity], IIf([Workorders].[BCBOE]=Yes,[Total Labor]/2) AS [Total Labor2]
FROM Employees INNER JOIN (Workorders RIGHT JOIN [workorders empdetails] ON Workorders.WorkorderID = [workorders empdetails].WorkorderID) ON Employees.EmployeeID = [workorders empdetails].[Employee - 1:]
GROUP BY Workorders.WorkorderID, Workorders.[Date:], Workorders.[Customer:], Workorders.[Signal Locations:], Workorders.[School Flashers:], Workorders.[Flasher Locations:], Workorders.[Time Arrived:], Workorders.[Time Completed:], Workorders.[Work Activity];
the area in question is the IIF for Total Labor2
The error I am getting is
You tried to execute a query that does not include the specified expression <name> as part of an aggregate function. (Error 3122)
You tried to execute a query that does not include the specified expression as part of an aggregate function or grouping.
Possible cause:
You did not enter an aggregate function in the TRANSFORM statement.
Thanks