AND OR driving me crazy

E

Edwin Merced

I have mutliple Boolean fields (yes/No records) in a query. How do I filter
ANY field that happens to have a False criteria
 
B

Brendan Reynolds

WHERE Field1 = False OR Field2 = False OR Field3 = False

If you have a lot of these fields, it may be worth thinking about whether
they really should be records in a related table. The process then becomes
much simpler ...

FROM Table1 INNER JOIN Table2 ON Table1.SomeField = Table2.SomeField WHERE
Table2.BooleanField = False

.... and this does not need to change regardless of how many matching records
there may be in Table2, whereas in the first example, if you ever find a
need to add another one of those fields, you'll have to modify the query as
well.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
G

Graham R Seach

Edwin,

If you want to filter out all those fields with Boolean True:
WHERE Field1 = False

If you want to flag the situation where one or more fields are False:
WHERE Not (Field1 AND Field2 AND Field3)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Top