"Not eaual to" query

  • Thread starter Thread starter Logsman
  • Start date Start date
L

Logsman

In the CRITERIA box, i put "<>"SRFD" OR "OFD"
OR "FFD...etc"" and run the query. I still get a list
including OFD and FFD...etc. How do i find everything in
this field that is not equal to my criteria?

mike
 
Dear Mike:

There is a syntax available for those not accustomed to the use of
formal logic which may be more satisfactory:

NOT IN("SRFD", "OFD", "FFD")

Just put the rest of your list in this. It probably reads better for
most people anyway.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Tom's solution is the one I often use but to explain the behaviour you
observed, Access parse your criteria (using the default order of operations)
as:

( YourField <> "SRFD" )
OR ( YourField = "OFD" )
OR ( YourField = "FFD" )
.....

Note: The equal (=) operator is assumed in the Query Design grid.

Thus, you got "OFD" and "FFD" in the selected rows.

For this to work properly, you need to change the order of operations using
parentheses like:

<> ( "SRFD" OR "OFD" OR "FFD" ...)
 
Back
Top