Access Query Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devarts
    New Member
    • Feb 2014
    • 16

    Access Query Question

    I have six check box type fields. I would like to have a field in my query that says the following:

    If one of the six fields are true then show me the data for that record

    but if all the boxes are false then do not show me the data for that record

    I am only interested in data that has at least one of the check boxes checked.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    It sounds like you just need a WHERE clause in your query. So lets say your six fields are

    Field1
    Field2
    Field3
    Field4
    Field5
    Field6

    Then you would just put the following in the WHERE clause
    Code:
    WHERE (Field1 = True OR Field2 = True OR
    Field3 = True OR Field4 = True OR
    Field5 = True OR Field6 = True)
    This doesn't add a field to your query, but it does limit which records are returned.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32645

      #3
      A simpler alternative would be :
      Code:
      WHERE ([chk1] OR [chk2] OR [chk3] OR [chk4] OR [chk5] OR [chk6])
      It's never a good idea to compare a boolean value to True or False. It has a tendency to confuse the reader and the writer. It never helps understanding to do so, and can even cause unexpected results when it's run.

      Comment

      Working...