Code:
SELECT [TimesheetDate]+7-Weekday([TimesheetDate],2) AS LockheedWE, DateAdd("m",1,DateSerial(Format([TimesheetDate],"yyyy"),Format([TimesheetDate],"m"),1))-1 AS EOMonth, Unanet.Company, Unanet.EmployeeType, Unanet.BillingAccountNo, [LastName] & ", " & [FirstName] AS FullName, Unanet.ProjectName, Unanet.ServiceItem, Unanet.TaskName, [VIP] & [SCATcode] AS VIPno, Unanet.ExostarLineNo, Unanet.LaborCat, Sum(Unanet.UnanetHours) AS UnanetHours, Unanet.UnanetBillingRate, Sum(Round([UnanetHours]*[UnanetBillingRate],2)) AS UnanetInvoiceAmt
FROM Unanet
GROUP BY [TimesheetDate]+7-Weekday([TimesheetDate],2), DateAdd("m",1,DateSerial(Format([TimesheetDate],"yyyy"),Format([TimesheetDate],"m"),1))-1, Unanet.Company, Unanet.EmployeeType, Unanet.BillingAccountNo, [LastName] & ", " & [FirstName], Unanet.ProjectName, Unanet.ServiceItem, Unanet.TaskName, [VIP] & [SCATcode], Unanet.ExostarLineNo, Unanet.LaborCat, Unanet.UnanetBillingRate
HAVING (((Unanet.ProjectName)="CAMEO LB Option Year 1"));
If I remove the field with the 2nd occurrence of the SUM function, the query will execute. If I leave in both SUM functions as I have in the code above (trying to add hours and invoice amount), the code will execute, but I don't see that the hours and invoice amount have been added in cases where the values of all other fields are the same. For example, I might see 3 particular rows that have: