Hi All,
I have a table with three checkboxes that I want to query. I need to be able to check any box (or boxes) and return records where the box/boxes is checked, but not records where it is unchecked.
I tried this but it keeps returning all records, regardless of the checked status:
If I do the following, it works fine when 1 box is checked but as soon as I check more than 1 box I get no records returned.
What would be the proper way to write out this query so that the proper records are returned?
Thanks in advance for any help.
Kind regards,
Ken
I have a table with three checkboxes that I want to query. I need to be able to check any box (or boxes) and return records where the box/boxes is checked, but not records where it is unchecked.
I tried this but it keeps returning all records, regardless of the checked status:
SQL:
(chk1 LIKE %s OR %s IS NULL) OR (chk2 LIKE %s OR %s IS NULL) OR (chk3 LIKE %s OR %s IS NULL)
If I do the following, it works fine when 1 box is checked but as soon as I check more than 1 box I get no records returned.
SQL:
(chk1 LIKE %s OR %s IS NULL) AND (chk2 LIKE %s OR %s IS NULL) AND (chk3 LIKE %s OR %s IS NULL)
What would be the proper way to write out this query so that the proper records are returned?
Thanks in advance for any help.
Kind regards,
Ken