I receive a RunTime 3296 - Join Expression Not Supported error when I try to run this query through VBA. However, I cannot figure out why. Any ideas?
'RunSQL = " SELECT Sm_price_rule4![RULE ID], Sm_price_rule4!BRANCH, Sm_price_rule4!DESCRIPTION, "
'RunSQL = RunSQL & " CusGroup!GroupDescription, Sm_price_rule2!EFFECTIVE, Sm_price_rule2!EXPIRY, "
'RunSQL = RunSQL & " Sm_price_rule2!ID, IIf([FORWARD CHARGE LEVELS]>'0','Y','N') AS FWD_CHG,"
'RunSQL = RunSQL & " Sm_price_rule1!BREAK, Sm_price_rule1![%], First(Sm_price_rule2!CONDITION) "
'RunSQL = RunSQL & " AS FirstOfCONDITION, Sm_price_rule4![PRODUCT GROUP], Sm_price_rule4![CUSTOMER GROUP], "
'RunSQL = RunSQL & " Sm_price_rule4![SUB TYPE] FROM (Sm_price_rule4 INNER JOIN CusGroup ON "
'RunSQL = RunSQL & " Sm_price_rule4![CUSTOMER GROUP] = CusGroup!GroupCode) INNER JOIN "
'RunSQL = RunSQL & " Sm_price_rule2 ON Sm_price_rule4![RULE ID] = Sm_price_rule2![RULE ID]) "
'RunSQL = RunSQL & " INNER JOIN Sm_price_rule1 ON (Sm_price_rule2!ID = Sm_price_rule1!ID) "
'RunSQL = RunSQL & " AND (Sm_price_rule2![RULE ID] = Sm_price_rule1![RULE ID])"
'RunSQL = RunSQL & " GROUP BY Sm_price_rule4![RULE ID], Sm_price_rule4!BRANCH, "
'RunSQL = RunSQL & " Sm_price_rule4!DESCRIPTION, CusGroup!GroupDescription, Sm_price_rule2!EFFECTIVE, "
'RunSQL = RunSQL & " Sm_price_rule2!EXPIRY, Sm_price_rule2!ID, IIf([FORWARD CHARGE LEVELS]>'0','Y','N'), "
'RunSQL = RunSQL & " Sm_price_rule1!BREAK, Sm_price_rule1![%], Sm_price_rule4![PRODUCT GROUP], "
'RunSQL = RunSQL & " Sm_price_rule4![CUSTOMER GROUP], Sm_price_rule4![SUB TYPE] "
'RunSQL = RunSQL & " Having (((Sm_price_rule2!EXPIRY)>=Now()) AND ((Sm_price_rule4![PRODUCT GROUP]) "
'RunSQL = RunSQL & " Like [Enter Manufacturer Code]) AND ((Sm_price_rule4![SUB TYPE]) Like 'R*'));"
Thanks in advance!
'RunSQL = " SELECT Sm_price_rule4![RULE ID], Sm_price_rule4!BRANCH, Sm_price_rule4!DESCRIPTION, "
'RunSQL = RunSQL & " CusGroup!GroupDescription, Sm_price_rule2!EFFECTIVE, Sm_price_rule2!EXPIRY, "
'RunSQL = RunSQL & " Sm_price_rule2!ID, IIf([FORWARD CHARGE LEVELS]>'0','Y','N') AS FWD_CHG,"
'RunSQL = RunSQL & " Sm_price_rule1!BREAK, Sm_price_rule1![%], First(Sm_price_rule2!CONDITION) "
'RunSQL = RunSQL & " AS FirstOfCONDITION, Sm_price_rule4![PRODUCT GROUP], Sm_price_rule4![CUSTOMER GROUP], "
'RunSQL = RunSQL & " Sm_price_rule4![SUB TYPE] FROM (Sm_price_rule4 INNER JOIN CusGroup ON "
'RunSQL = RunSQL & " Sm_price_rule4![CUSTOMER GROUP] = CusGroup!GroupCode) INNER JOIN "
'RunSQL = RunSQL & " Sm_price_rule2 ON Sm_price_rule4![RULE ID] = Sm_price_rule2![RULE ID]) "
'RunSQL = RunSQL & " INNER JOIN Sm_price_rule1 ON (Sm_price_rule2!ID = Sm_price_rule1!ID) "
'RunSQL = RunSQL & " AND (Sm_price_rule2![RULE ID] = Sm_price_rule1![RULE ID])"
'RunSQL = RunSQL & " GROUP BY Sm_price_rule4![RULE ID], Sm_price_rule4!BRANCH, "
'RunSQL = RunSQL & " Sm_price_rule4!DESCRIPTION, CusGroup!GroupDescription, Sm_price_rule2!EFFECTIVE, "
'RunSQL = RunSQL & " Sm_price_rule2!EXPIRY, Sm_price_rule2!ID, IIf([FORWARD CHARGE LEVELS]>'0','Y','N'), "
'RunSQL = RunSQL & " Sm_price_rule1!BREAK, Sm_price_rule1![%], Sm_price_rule4![PRODUCT GROUP], "
'RunSQL = RunSQL & " Sm_price_rule4![CUSTOMER GROUP], Sm_price_rule4![SUB TYPE] "
'RunSQL = RunSQL & " Having (((Sm_price_rule2!EXPIRY)>=Now()) AND ((Sm_price_rule4![PRODUCT GROUP]) "
'RunSQL = RunSQL & " Like [Enter Manufacturer Code]) AND ((Sm_price_rule4![SUB TYPE]) Like 'R*'));"
Thanks in advance!