Multiple "Not like" exclusionary query

G

Guest

I have 18 different departments that I work for. I want to run a list of
employees within the departments who need to file an option form. The thing
is that some departments do not allow this option, so I'd like to exclude
those employees from my query. The problem is that I am using this criteria
and it's not working!

Not "12010" Or "18000" Or "17000" Or "17020" Or "17100" Or "21600"

Help???
 
M

MH

Not "12010" And Not "18000" ...

You would probably be better off using a table to store these department IDs
in and use an unmatched query.

MH
 
A

Allen Browne

As written, Access applies the Not to just the first item. Since all the
other numbers are not 12010, they make no difference at all.

You need brackets around all the numbers after the Not, i.e.:
Not ("12010" Or "18000" Or "17000" Or "17020" Or "17100" Or "21600")

It might be easier to write:
Not In ("12010", "18000", "17000", "17020", "17100", "21600")

Note that if this is a Number field (not a Text field), you need to drop all
the quotes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top