title: Select Access Items where Checkboxes indicate Field Values
body: <p>In my database I have a table with several yes/no columns.</p>
  
  <p>Now, I have a unbound form with some unbound checkboxes and a listbox bound to a special query just for it.  </p>
  
  <p>I want to use the checkboxes on the form to filter the listbox and display items in the list that have matching values. </p>
  
  <p>For example, </p>
  
  <ul>
  <li>If I check box1 on the form, <em>any</em> item that contains field1 in the listbox should show.  </li>
  <li>If I check box2 and box3 on the form, <em>any</em> item that contains field2 AND field3 should display in the listbox. If an item does not have both field3 AND field3, their entries should not show in the list because the boxes are not checked.</li>
  </ul>
  
  <p>Each control on the form uses an on-click event procedure to cause the list to requery.</p>
  
  <p>Right now, this doesn't work right for me.  My listbox only displays items when ALL the values match the checkbox.  So, if I check box1 and box2, I <em>only</em> get the results from items that have <em>only</em> field1 and field2.  If the item <em>also</em> has field3, it doesn't display - and this is my problem.</p>
  
  <p>This is what my query looks like so far:</p>
  
  <pre><code>SELECT MyQuery.title, field1, MyQuery.field2, MyQuery.field3
  FROM MyQuery
  WHERE (
  (
  (MyQuery.field1) like [Forms]![Ability Finder]![box1]
  )AND(
  (MyQuery.field2) like [Forms]![Ability Finder]![box2]
  )AND(
  (MyQuery.field2) like [Forms]![Ability Finder]![box3]
  )
  
  );
  </code></pre>
  
  <p>Maybe I'm going about this all the wrong way.  Also, I have about 20 checkboxes for which I need to do this.</p>
  
  <pre><code>SELECT MyQuery.cat, MyQuery.nickname, MyQuery.title, MyQuery.level, MyQuery.field1, MyQuery.field2, MyQuery.field3
  FROM MyQuery
  WHERE (
  ((MyQuery.field1)=[Forms]![Ability Finder]![box1] Or [Forms]![Ability Finder]![box1] Is Null) 
  AND ((MyQuery.field2)=[Forms]![Ability Finder]![box2] Or [Forms]![Ability Finder]![box2] Is Null) 
  AND ((MyQuery.field3)=[Forms]![Ability Finder]![box3] Or [Forms]![Ability Finder]![box3] Is Null)
  );
  </code></pre>