C
cskester
Please help with syntax error. Thank you
DoCmd.RunSQL "INSERT INTO [Monthly Sales]( DISTRIBUTOR,
SLSLNO, SLSLNO_NEW, SLSLNM, SALES, SALES_MO )SELECT
Distributors.Distributor, [qrySelect Distributors].SLSLNO,
[qrySelect Distributors].SLSLNO AS slslno_NEW, [qrySelect
Distributors].SLSLNM, Sum([SLBUSA]*[SLIVQT]) AS SALES, Left
([qrySelect Distributors].[SLIVDT],6) AS Sales_Mo FROM
[qrySelect Distributors] INNER JOIN Distributors ON
[qrySelect Distributors].SLCUNO = Distributors.DistNo
GROUP BY Distributors.Distributor, [qrySelect
Distributors].SLSLNO, [qrySelect Distributors].SLSLNO,
[qrySelect Distributors].SLSLNM, Left([qrySelect
Distributors].[SLIVDT],6) HAVING ((([qrySelect
Distributors].SLSLNM) Not Like "*house*" And ([qrySelect
Distributors].SLSLNM)<>" "))ORDER BY [qrySelect
Distributors].SLSLNO;"
DoCmd.RunSQL "INSERT INTO [Monthly Sales]( DISTRIBUTOR,
SLSLNO, SLSLNO_NEW, SLSLNM, SALES, SALES_MO )SELECT
Distributors.Distributor, [qrySelect Distributors].SLSLNO,
[qrySelect Distributors].SLSLNO AS slslno_NEW, [qrySelect
Distributors].SLSLNM, Sum([SLBUSA]*[SLIVQT]) AS SALES, Left
([qrySelect Distributors].[SLIVDT],6) AS Sales_Mo FROM
[qrySelect Distributors] INNER JOIN Distributors ON
[qrySelect Distributors].SLCUNO = Distributors.DistNo
GROUP BY Distributors.Distributor, [qrySelect
Distributors].SLSLNO, [qrySelect Distributors].SLSLNO,
[qrySelect Distributors].SLSLNM, Left([qrySelect
Distributors].[SLIVDT],6) HAVING ((([qrySelect
Distributors].SLSLNM) Not Like "*house*" And ([qrySelect
Distributors].SLSLNM)<>" "))ORDER BY [qrySelect
Distributors].SLSLNO;"