Hi Piet,
Each individual query does run successfully. Here is the SQL for the query
that gives me the 3183 error:
SELECT qryOCProfitFinalByClinicOCNetSales.[2007] AS OCNetSales2007,
qryOCProfitFinalByClinicOCNetSales.[2008] AS OCNetSales2008,
qryOCProfitFinalByClinicOCNetSales.[2009] AS OCNetSales2009,
qryOCProfitFinalByClinicOCNetSales.OC_NetSales_TTM, addreplist.[Dist Name],
addreplist.[Rep Name], qryOCProfitFinalByClinicOCNetSales.[Acct #],
qryOCProfitFinalByClinicOCNetSales.[Acct Name],
qryOCProfitFinalByClinicOCNetSales.[Corp #],
qryOCProfitFinalByClinicOCNetSales.Opened,
qryOCProfitFinalByClinicOCNetSales.[Status Code],
t_OCProfit_ANALYSIS_BY_CORP.Tier,
q_sc_Corp_TNF_Grade_LastPeriod.TNF_SalesPct,
q_sc_Corp_TNF_Grade_LastPeriod.Grade AS TNF_Grade,
q_sc_Corp_ASP_LastPeriod.OC_ASP, q_sc_Corp_ASP_LastPeriod.Grade AS GradeASP,
q_sc_Corp_ASP_Last12_s2.ASP AS ASP_Last12Mo,
q_sc_Corp_ASP_LastPeriod.ASP_OCAvg, q_sc_Corp_TNF_Grade_LastPeriod.TNF_OCavg,
t_OCProfit_ANALYSIS_BY_CORP.InvList,
t_OCProfit_ANALYSIS_BY_CORP.LastMonthInvWeeks AS InvWeeks,
t_OCProfit_ANALYSIS_BY_CORP.Grade_Inv, q_sc_Corp_PPAleadTime_Last.PPAlag AS
PPAlagLast, q_sc_Corp_PPAleadTime_Last.Grade AS PPAlagGrade,
q_sc_Corp_PPAleadTime_Last3.PPAlag AS PPAlagLast3, IIf([Clinic Payment
Table]![Field Tech]="DJO","Staffed Account - DJO",IIf([Clinic Payment
Table]![Field Tech]="DP","Staffed Account - Distributor","Non-staffed
Account")) AS FTech, q_sc_Corp_PPAleadTime_OCAvg.PPAlagOCavg,
q_sc_Corp_PctPPAsOver30.PctOver30, q_sc_Corp_PctPPAsOver30.Grade AS
PctOver30Grade, q_sc_Corp_CollectRate_Last_s2.Rate AS CollectionRate,
q_sc_Corp_CollectRate_Last_s2.CollectionGrade,
q_sc_Corp_HB_last4weeksGrade_2.HB, q_sc_Corp_HB_last4weeksGrade_2.[%HB],
q_sc_Corp_HB_last4weeksGrade_2.Grade AS HB_Grade,
q_sc_Corp_HB_last4weeksGrade_2.[%HB_OCavg], addreplist.GM AS RD,
addreplist.ServiceManager AS RSM, t_OCProfit_ANALYSIS_BY_CORP.NbrOfLoc INTO
q_sc_Corp_Accounts
FROM q_sc_Corp_PPAleadTime_OCAvg RIGHT JOIN
((((((((((((qryOCProfitFinalByClinicOCNetSales INNER JOIN (addreplist AS
addreplist_1 INNER JOIN q_run_sc_CorpNextRep ON addreplist_1.[Rep Name] =
q_run_sc_CorpNextRep.[Rep Name]) ON qryOCProfitFinalByClinicOCNetSales.[Acct
#] = addreplist_1.[Acct #]) LEFT JOIN q_sc_Corp_HB_last4weeksGrade_2 ON
qryOCProfitFinalByClinicOCNetSales.[Acct #] =
q_sc_Corp_HB_last4weeksGrade_2.[Acct #]) LEFT JOIN q_sc_Corp_PPAleadTime_Last
ON qryOCProfitFinalByClinicOCNetSales.[Acct #] =
q_sc_Corp_PPAleadTime_Last.Acct) LEFT JOIN q_sc_Corp_CollectRate_Last_s2 ON
qryOCProfitFinalByClinicOCNetSales.[Corp #] =
q_sc_Corp_CollectRate_Last_s2.[Corp #]) LEFT JOIN q_sc_Corp_PctPPAsOver30 ON
qryOCProfitFinalByClinicOCNetSales.[Acct #] = q_sc_Corp_PctPPAsOver30.[Acct
#]) LEFT JOIN addreplist ON qryOCProfitFinalByClinicOCNetSales.[Acct #] =
addreplist.[Acct #]) LEFT JOIN q_sc_Corp_TNF_Grade_LastPeriod ON
qryOCProfitFinalByClinicOCNetSales.[Acct #] =
q_sc_Corp_TNF_Grade_LastPeriod.[Acct #]) LEFT JOIN q_sc_Corp_ASP_LastPeriod
ON qryOCProfitFinalByClinicOCNetSales.[Acct #] =
q_sc_Corp_ASP_LastPeriod.[Acct #]) LEFT JOIN q_sc_Corp_ASP_Last12_s2 ON
qryOCProfitFinalByClinicOCNetSales.[Acct #] = q_sc_Corp_ASP_Last12_s2.[Acct
#]) LEFT JOIN q_sc_Corp_PPAleadTime_Last3 ON
qryOCProfitFinalByClinicOCNetSales.[Acct #] =
q_sc_Corp_PPAleadTime_Last3.Acct) INNER JOIN t_OCProfit_ANALYSIS_BY_CORP ON
qryOCProfitFinalByClinicOCNetSales.[Corp #] =
t_OCProfit_ANALYSIS_BY_CORP.CorpAcct) LEFT JOIN [Clinic Payment Table] ON
qryOCProfitFinalByClinicOCNetSales.[Acct #] = [Clinic Payment Table].[Account
Number]) ON q_sc_Corp_PPAleadTime_OCAvg.FYM =
qryOCProfitFinalByClinicOCNetSales.FYM
WHERE (((qryOCProfitFinalByClinicOCNetSales.[Acct #])=178838) AND
((qryOCProfitFinalByClinicOCNetSales.[Status Code])="ACTIVE"));
Maybe you can help guide me to where I should start troubleshooting the SQL
statement. I'm sure this is not the best-designed query! =)