Others

How to Add Multiple Status Criteria to an Access List Box Filter

Steve KSteve K Nov 2, 2026 868 views

Question details

The user needs to construct a dynamic Access report filter that combines standard text/combo box criteria with multiple status values selected from a list box.

How to Add Multiple Status Criteria to an Access List Box Filter
Product
Microsoft Access
Device & OS
not provided
Scenario
Building a report filter via VBA where end-users can select multiple statuses (like Closed, OnProgress, and Open) from a list box to query the database.
Observed behavior
The standard filter string works, but appending the multiple selections from the list box results in syntax errors, often due to trailing AND/OR operators in the generated SQL string.
Before you start

Ensure your form is open in Design View and verify that the list box's 'Multi Select' property in the Property Sheet is set to 'Simple' or 'Extended'.

Solution 1Recommended

Build the VBA Filter String using ItemsSelected

Use a VBA loop to iterate through the list box selections, build an encapsulated OR condition, and cleanly combine it with your existing report filters.

To properly filter a report based on multiple list box selections, you cannot rely on simple control referencing. You must write VBA code that loops through the ItemsSelected collection of the list box, formats the selected strings, and constructs a parenthesized SQL condition.

1
Loop through the list box items

In your VBA event (e.g., a button click), create a `For Each` loop to iterate over `Me.lst_Status.ItemsSelected`. Extract each selected value and concatenate it into a string with ' OR ' between them.

2
Format the string condition

Wrap the final list box criteria in parentheses to ensure it evaluates correctly alongside other combo box filters. For example: `(Status = 'Open' OR Status = 'Closed')`.

3
Append to the main filter

Combine this string with your other date or text filters using the ' AND ' operator.

4
Remove the trailing AND

Use the `Len()` and `Left()` functions to check the end of your complete filter string and strip out the final ' AND ' before assigning it to the report's Filter property.

Build the VBA Filter String using ItemsSelected
Debugging Tip: Add `Debug.Print yourFilterString` right before applying the filter. This prints the exact string to the Immediate Window (Ctrl+G). You can copy this output into a new blank query's SQL View and switch to Design View to let Access easily validate any syntax errors.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite?

While WPS Office does not include a direct database management tool like MS Access, it provides powerful, free alternatives for Word, Excel, and PowerPoint. If you are managing or exporting database reports, WPS Spreadsheet seamlessly handles .xlsx files with advanced filtering, pivot tables, and data analysis tools.

  1. 1. Export your Data: Export your Microsoft Access report data to an Excel format (.xlsx) to perform deeper analysis.
  2. 2. Open with WPS: Launch WPS Office and open the exported spreadsheet file using the WPS Spreadsheet module.
  3. 3. Analyze Data: Use the built-in Data Filter and PivotTable tools to easily organize and review records matching multiple status criteria.
Free, lightweight, and incredibly easy to useHigh compatibility with Microsoft Office file formats (.docx, .xlsx, .pptx)Familiar tabbed interface for seamless migration and quick onboardingPowerful data analysis and filtering features in WPS Spreadsheet
microsoft office alternative - wps office

Frequently Asked Questions

How do I enable multiple selections in an Access list box?

Open your form in Design View, click on the list box, and press F4 to open the Property Sheet. Go to the 'Other' tab and change the 'Multi Select' property from 'None' to either 'Simple' or 'Extended'.

Why am I getting a syntax error when my VBA SQL filter runs?

Syntax errors in dynamic SQL are most commonly caused by a trailing 'AND' or 'OR' left at the end of the string, or by missing single quotes around text values. Always strip trailing operators before passing the string to the Filter property.

How can I see the exact filter string my VBA code generated?

Insert the line `Debug.Print strFilter` in your VBA code before the filter is applied. Press Ctrl+G to open the Immediate Window, where the generated string will be printed out for you to review or copy.