Filter a Microsoft Access Query Using Form Checkboxes
Question details
The user needs an Access query to return records only for categories selected with form checkboxes.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A form has a checkbox for each category, and each category is currently stored in a separate table.
- Observed behavior
- The query returns no records when only some category checkboxes are selected.
Identify the category tables, checkbox control names, and fields they have in common. Open the filter form before running a query that references its controls.
Use related category tables and grouped checkbox conditions
Use this approach to filter a consolidated products or assets table by the categories checked on a form.
Store categories as records in a Categories table rather than as separate product tables. A Products table can then reference each category through a CategoryID foreign key.
The example below assumes CategoryID values 1 and 2, a form named frmFilter, and checkbox controls named chkCategory1 and chkCategory2. Replace these names and values with your own.
In Access, select Create > Table Design and create a Categories table with CategoryID as its primary key and a Category name field. Add one record for each category.
Create a Products or Assets table with the shared fields and a CategoryID field. Use Create > Query Design and an Append query to move records from each category table, assigning the matching CategoryID to each group. Account for existing primary keys and relationships when migrating records.
Open Database Tools > Relationships and link Categories.CategoryID to Products.CategoryID. Use compatible field types and enforce referential integrity after confirming that every product has a matching category.
Open the query in SQL View and use conditions like: SELECT * FROM Products WHERE (CategoryID = 1 AND Forms![frmFilter]![chkCategory1] = True) OR (CategoryID = 2 AND Forms![frmFilter]![chkCategory2] = True); Add another parenthesized condition joined by OR for each additional checkbox.
Open frmFilter in Form View, select one or more category checkboxes, and run the query. Check that each selection returns only records with the corresponding CategoryID.

Work with exported category data in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar interface for working with spreadsheet exports. It supports common Microsoft Office formats for an easier transition, but it does not fix or replace an Access form query.

Frequently Asked Questions
Why does my Access query return no records when only some boxes are checked?
Conditions joined only by AND may require a record to match multiple categories at once. In SQL View, group each category and its checkbox with AND, then join those groups with OR.
Does the filter form need to be open when I run the query?
Yes. A reference such as Forms![frmFilter]![chkCategory1] requires the named form to be open so Access can read the checkbox value.
What happens if none of the category boxes are checked?
The example query returns no records because none of its OR conditions is true. To show all categories instead, add logic that explicitly handles the no-selection case.
Can I use a multi-select list box instead of many checkboxes?
Yes. A list box can be populated from the Categories table, making it easier to include new categories. Its selections are read through the ItemsSelected collection, so form code must turn the selected IDs into a suitable query filter; a comma-separated text value alone is not automatically treated as an IN list.




