Access 2010 problem with criteria

The following works:

  • "a"
  • "b"
  • "a" or "b"
  • Not "a"
  • Not "b"

The following does not work

  • Not "a" or Not "b"

Here the criteria get ignored completely.

Why is that?

I’m not looking for a workaround, just an explanation.

  • 2
    If it is A then it is not B, and if it is B it is not A, so it would always go true ... do you mean not a and not b ? – ivanivan Mar 4 at 1:34

The criteria isn't being ignored, but rather the criteria is always validated.

Consider that:

  • (not "a") matches anything not equal to "a" (hence this will include "b")
  • (not "b") matches anything not equal to "b" (hence this will include "a")

As such, (not "a") or (not "b") will always return all records.

Another way to think about this is that:

(not "a") or (not "b") 

is equivalent to:

not ("a" and "b")

And since something cannot be both "a" and "b" at the same time, this will always be validated.

I suspect that you actually require the logic:

(not "a") and (not "b")

Which may be equivalently written:

not ("a" or "b")

That it to say, neither "a" nor "b"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.