Gustav Brock
Gustav at cactus.dk
Thu Dec 21 02:19:49 CST 2006
Hi Keith This line caught my eye: "WHERE [qryWeeklyTimesheetVarianceSummary].[Entity] = "00" And Should read: "WHERE [qryWeeklyTimesheetVarianceSummary].[Entity] = '00' And /gustav >>> Kwilliamson at RTKL.com 20-12-2006 23:59 >>> Well....I tried that, as follows: Dim strSQL As String strSQL = "SELECT [qryWeeklyTimesheetVarianceSummary].[Year], [qryWeeklyTimesheetVarianceSummary].[Month], [qryWeeklyTimesheetVarianceSummary].[Entity], Sum([qryWeeklyTimesheetVarianceSummary].[SumOfRegPay]) AS [Reg Stand Cost], Sum([qryWeeklyTimesheetVarianceSummary].[SumOfOvtPay]) AS [OT Standard Cost], Sum([qryWeeklyTimesheetVarianceSummary].[SumOfOvt2Pay]) AS [OT2 Standard Cost], Sum([sumofregpay]+[sumofovtpay]+[sumofovt2pay]) AS [Total Standard Cost], Sum([qryWeeklyTimesheetVarianceSummary].[ActReg]) AS [Calc Reg Cost], Sum([qryWeeklyTimesheetVarianceSummary].[ActOvt]) AS [Calc OT Cost], Sum([qryWeeklyTimesheetVarianceSummary].[ActOvt2]) AS [Calc OT2 Cost], Sum([actreg]+[actovt]+[actovt2]) AS [Total Calc Cost], First([qryPayrollPaid].[SumOfAmountPaid]) AS FirstOfSumOfAmountPaid, First([qryPayrollDiffSummary].[SumOfHrs]) AS FirstOfSumOfHrs, First([qryPayrollDiffSummary].[SumOfWageDiff]) AS FirstOfSumOfWageDiff " + _ "FROM qryPayrollDiffSummary RIGHT JOIN (qryPayrollPaid RIGHT JOIN qryWeeklyTimesheetVarianceSummary ON ([qryPayrollPaid].[Year]=[qryWeeklyTimesheetVarianceSummary].[Year]) AND ([qryPayrollPaid].[Month]=[qryWeeklyTimesheetVarianceSummary].[Month]) AND ([qryPayrollPaid].[Entity]=[qryWeeklyTimesheetVarianceSummary].[Entity]) ) ON ([qryPayrollDiffSummary].[Entity]=[qryWeeklyTimesheetVarianceSummary].[E ntity]) AND ([qryPayrollDiffSummary].[Month]=[qryWeeklyTimesheetVarianceSummary].[Mo nth]) AND ([qryPayrollDiffSummary].[Year]=[qryWeeklyTimesheetVarianceSummary].[Yea r]) " + _ "WHERE [qryWeeklyTimesheetVarianceSummary].[Entity] = "00" And [qryWeeklyTimesheetVarianceSummary].[Month] = 10 And [qryWeeklyTimesheetVarianceSummary].[Year] = 2006 " + _ "GROUP BY [qryWeeklyTimesheetVarianceSummary].[Year], [qryWeeklyTimesheetVarianceSummary].[Month], [qryWeeklyTimesheetVarianceSummary].[Entity]; " Me.RecordSource = strSQL Made no difference. I still got the Syntax Error.