How to Add Multiple Status Criteria to an Access List Box Filter
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.

- 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.
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'.
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.
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.
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')`.
Combine this string with your other date or text filters using the ' AND ' operator.
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.

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. Export your Data: Export your Microsoft Access report data to an Excel format (.xlsx) to perform deeper analysis.
- 2. Open with WPS: Launch WPS Office and open the exported spreadsheet file using the WPS Spreadsheet module.
- 3. Analyze Data: Use the built-in Data Filter and PivotTable tools to easily organize and review records matching multiple status criteria.

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.




