Others

Filter a Microsoft Access Query Using Form Checkboxes

Amos GikundaAmos Gikunda Nov 25, 2026 869 views

Question details

The user needs an Access query to return records only for categories selected with form checkboxes.

Filter a Microsoft Access Query Using 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.
Before you start

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.

Solution 1Recommended

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.

1
Create the category table

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.

2
Consolidate the records

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.

3
Create the relationship

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.

4
Enter the grouped filter

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.

5
Test the query

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.

Use related category tables and grouped checkbox conditions
When no boxes are checked: The example returns no records if all checkboxes are unchecked. Add separate logic if you want no selection to show every category instead.
Free Microsoft Office alternative

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.

Sort and filter exported category records in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with a free, lightweight office suite
microsoft office alternative - wps office

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.