I would like to filter all the rows that are:
field like "*AA*" and field not like "*BB*"
But this is returning everything instead of showing all the rows that contains AA
and doesn't contain BB
.
well now it works like expected, just restarted ms access...
Sorry for my typo... :s updated
What I found out is that MS Access will reject --Not Like "BB*"-- if not enclosed in PARENTHESES, unlike --Like "BB*"-- which is ok without parentheses.
I tested these on MS Access 2010 and are all valid:
Like "BB"
(Like "BB")
(Not Like "BB")
Simply restate the target field & condition;
where (field like "*AA*" and field not like "*BB*")
If you're doing it in VBA (and not in a query) then: where field like "AA" and field not like "BB" then would not work.
You'd have to use: where field like "AA" and field like "BB" = false then
Not sure if this is still extant but I'm guessing you need something like
((field Like "AA*") AND (field Not Like "BB*"))
what's the problem with:
field like "*AA*" and field not like "*BB*"
it should be working.
Could you post some example of your data?
Source: Stackoverflow.com