D
dmoney
Hello all- I am pulling data from an access dbase and have ran into a syntax
issue. Does anyone what is wrong with the last line? The data pulls, but
ignore the not like statements and i get all the items with gfm and cfm in
the material name along with the data im looking for. I need to exclude all
records with GFM or CFM in the material field. Please help
strsql = "SELECT PEGG_TASSRAW.Plnt, PEGG_TASSRAW.Material,
CJI3ByReplen.Description, CJI3ByReplen.PurchDoc, PEGG_TASSRAW.[Replenishment
Element], PEGG_TASSRAW.[Grouping WBS el], PEGG_TASSRAW.[Assigned WBS],
PEGG_TASSRAW.[In Stock], PEGG_TASSRAW.Surplus, PEGG_TASSRAW.Scrap,
PEGG_TASSRAW.Loss, PEGG_TASSRAW.[Target Qty], PEGG_TASSRAW.[Created on],
CJI3ByReplen.[SumOfValue TCur], PEGGTASSONLY_ANALYST.Analyst,
PEGGTASSONLY_ANALYST.Comments, PEGGTASSONLY_ANALYST.Category,
PEGGTASSONLY_ANALYST.Actionee " _
& "FROM ((CJI3ByReplen RIGHT JOIN PEGG_TASSRAW ON CJI3ByReplen.Material =
PEGG_TASSRAW.Material) LEFT JOIN PEGGTASSONLY_ANALYST ON
PEGG_TASSRAW.Material = PEGGTASSONLY_ANALYST.Material) LEFT JOIN Controllers
ON PEGG_TASSRAW.Material = Controllers.Material " _
& "GROUP BY PEGG_TASSRAW.Plnt, PEGG_TASSRAW.Material,
CJI3ByReplen.Description, CJI3ByReplen.PurchDoc, PEGG_TASSRAW.[Replenishment
Element], PEGG_TASSRAW.[Grouping WBS el], PEGG_TASSRAW.[Assigned WBS],
PEGG_TASSRAW.[In Stock], PEGG_TASSRAW.Surplus, PEGG_TASSRAW.Scrap,
PEGG_TASSRAW.Loss, PEGG_TASSRAW.[Target Qty], PEGG_TASSRAW.[Created on],
CJI3ByReplen.[SumOfValue TCur], PEGGTASSONLY_ANALYST.Analyst,
PEGGTASSONLY_ANALYST.Comments, PEGGTASSONLY_ANALYST.Category,
PEGGTASSONLY_ANALYST.Actionee " _
& HAVING (((PEGG_TASSRAW.Material) Not Like [%gfm%] And
(PEGG_TASSRAW.Material) Not Like [%cfm%]) AND ((CJI3ByReplen.PurchDoc) Is
Null));
issue. Does anyone what is wrong with the last line? The data pulls, but
ignore the not like statements and i get all the items with gfm and cfm in
the material name along with the data im looking for. I need to exclude all
records with GFM or CFM in the material field. Please help
strsql = "SELECT PEGG_TASSRAW.Plnt, PEGG_TASSRAW.Material,
CJI3ByReplen.Description, CJI3ByReplen.PurchDoc, PEGG_TASSRAW.[Replenishment
Element], PEGG_TASSRAW.[Grouping WBS el], PEGG_TASSRAW.[Assigned WBS],
PEGG_TASSRAW.[In Stock], PEGG_TASSRAW.Surplus, PEGG_TASSRAW.Scrap,
PEGG_TASSRAW.Loss, PEGG_TASSRAW.[Target Qty], PEGG_TASSRAW.[Created on],
CJI3ByReplen.[SumOfValue TCur], PEGGTASSONLY_ANALYST.Analyst,
PEGGTASSONLY_ANALYST.Comments, PEGGTASSONLY_ANALYST.Category,
PEGGTASSONLY_ANALYST.Actionee " _
& "FROM ((CJI3ByReplen RIGHT JOIN PEGG_TASSRAW ON CJI3ByReplen.Material =
PEGG_TASSRAW.Material) LEFT JOIN PEGGTASSONLY_ANALYST ON
PEGG_TASSRAW.Material = PEGGTASSONLY_ANALYST.Material) LEFT JOIN Controllers
ON PEGG_TASSRAW.Material = Controllers.Material " _
& "GROUP BY PEGG_TASSRAW.Plnt, PEGG_TASSRAW.Material,
CJI3ByReplen.Description, CJI3ByReplen.PurchDoc, PEGG_TASSRAW.[Replenishment
Element], PEGG_TASSRAW.[Grouping WBS el], PEGG_TASSRAW.[Assigned WBS],
PEGG_TASSRAW.[In Stock], PEGG_TASSRAW.Surplus, PEGG_TASSRAW.Scrap,
PEGG_TASSRAW.Loss, PEGG_TASSRAW.[Target Qty], PEGG_TASSRAW.[Created on],
CJI3ByReplen.[SumOfValue TCur], PEGGTASSONLY_ANALYST.Analyst,
PEGGTASSONLY_ANALYST.Comments, PEGGTASSONLY_ANALYST.Category,
PEGGTASSONLY_ANALYST.Actionee " _
& HAVING (((PEGG_TASSRAW.Material) Not Like [%gfm%] And
(PEGG_TASSRAW.Material) Not Like [%cfm%]) AND ((CJI3ByReplen.PurchDoc) Is
Null));