Originally Posted by
June7
Must be some minor difference between the data. What are the sources for each of the GROUP BY queries?
Post full SQL statements of all queries.
Good idea about posting the SQL code, since I'm dealing with company data. Here is the SQL code for the query that is causing me trouble.
Code:
SELECT qryClickTimeSummary2.WeekEnding, qryClickTimeSummary2.Fullname, qryClickTimeSummary2.ProjectName, qryClickTimeSummary2.SumOfHours, qryBillingSummary2.WeekEnding, qryBillingSummary2.SumOfExostarHours
FROM qryClickTimeSummary2 LEFT JOIN qryBillingSummary2 ON (qryClickTimeSummary2.SumOfHours = qryBillingSummary2.SumOfExostarHours) AND (qryClickTimeSummary2.ProjectName = qryBillingSummary2.ProjectName) AND (qryClickTimeSummary2.Fullname = qryBillingSummary2.FullName) AND (qryClickTimeSummary2.WeekEnding = qryBillingSummary2.WeekEnding)
WHERE (((qryBillingSummary2.WeekEnding) Is Null) AND ((qryBillingSummary2.SumOfExostarHours) Is Null));
The query above is based on these two queries:
Code:
SELECT Billing.WeekEnding, Billing.EmploymentType, Billing.FullName, Billing.ProjectName, Billing.VIPnoSCAT, Billing.CLINECA, Billing.ExostarLineNo, Billing.LMApprover, Billing.HoursType, Sum(Billing.ExostarHours) AS SumOfExostarHours
FROM Billing
GROUP BY Billing.WeekEnding, Billing.EmploymentType, Billing.FullName, Billing.ProjectName, Billing.VIPnoSCAT, Billing.CLINECA, Billing.ExostarLineNo, Billing.LMApprover, Billing.HoursType
HAVING (((Billing.ProjectName)="XYZ"));
Code:
SELECT [TimesheetDate]+7-Weekday([TimesheetDate],2) AS WeekEnding, [LastName] & ", " & [FirstName] AS Fullname, ClickTime.ProjectName, [VIPno] & [SCATCode] AS VIP, ClickTime.ExostarLineNo, Sum(ClickTime.Hours) AS SumOfHours
FROM ClickTime
GROUP BY [TimesheetDate]+7-Weekday([TimesheetDate],2), [LastName] & ", " & [FirstName], ClickTime.ProjectName, [VIPno] & [SCATCode], ClickTime.ExostarLineNo
HAVING (((ClickTime.ProjectName)="XYZ"));
I agree that there must be some minor difference somewhere. I know I have done this in the past, but I deleted the previous queries that did work.
Notice how I am using calculated fields to come up with values for the WeekEnding and FullName values. I am trying to link these calculated fields to their counterparts in the other query. Those counterparts however, are not calculated fields. I wonder if this could somehow be the problem. As far as I can remember this is the only thing I changed. When this did work, I didn't have calculated fields for these values because I used formulas in the Excel spreadsheet to get these values, then I uploaded that into Access. I would like to avoid having to do that in my Excel sheet, that is why I decided to derive these values when I run the query with a calculated field.
I really appreciate your help.