ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   not like syntax in querry not working (https://www.excelbanter.com/excel-programming/440469-not-like-syntax-querry-not-working.html)

DMoney

not like syntax in querry not working
 
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));



All times are GMT +1. The time now is 07:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com