Others

How to Use Multiple Combo Boxes to Filter a Microsoft Access Form

Steve KSteve K Nov 2, 2026 869 views

Question details

The user needs a method to dynamically filter records in an Access form using two or more combo boxes that can act independently or together.

How to Use Multiple Combo Boxes to Filter a Microsoft Access Form
Product
Microsoft Access
Device & OS
not provided
Scenario
Modifying a Microsoft Access form header to allow users to filter thousands of records dynamically using criteria like 'AllocatedTo', 'GP_Practice', and a 'Completed' Yes/No field.
Observed behavior
The goal is to successfully apply a combined WHERE condition to the form's Recordset using VBA whenever a user makes a selection in any of the combo boxes.
Before you start

Ensure you have a backup of your Access database before modifying form designs or adding VBA code, and confirm the exact names of the fields in your underlying table or query.

Solution 1Recommended

Use a Shared VBA Procedure for Combo Box Filtering

The most effective way to handle multiple combo box filters is to create a single VBA subroutine that builds a dynamic WHERE clause based on the selected values.

By using unbound combo boxes in the form header, you can capture user selections without altering underlying table data. Triggering a shared VBA procedure in the 'After Update' event ensures the form updates instantly and handles independent or combined criteria perfectly.

1
Create unbound combo boxes

Open your Access form in Design View. Add unbound combo boxes to the Form Header for your criteria and name them clearly, such as 'cboAllocatedTo' and 'cboGP_Practice'.

2
Create a shared filtering procedure

Open the VBA editor and create a new Sub called 'FilterMe'. Declare a string variable to hold your SQL condition. Use 'If Not IsNull(Me.cboAllocatedTo) Then' to check if a value is selected, and append the appropriate SQL syntax to your string.

3
Add conditions for remaining combo boxes

Add additional 'If Not IsNull' blocks for 'cboGP_Practice' and any other optional filters (like a Yes/No 'Completed' field). Ensure you append the ' AND ' operator between conditions if your string is not empty.

4
Apply the filter string to the form

At the end of your VBA procedure, assign your completed string to 'Me.Filter' and set 'Me.FilterOn = True'. If the string remains empty (meaning no filters are selected), set 'Me.FilterOn = False' to show all records.

5
Trigger the filter on update

Select each combo box in Design View, navigate to the Property Sheet, and click the 'After Update' event. Add the command 'Call FilterMe' so the form updates immediately upon any user selection.

Security and Stability Best Practice: Always ensure text values are properly escaped (especially handling apostrophes in names) or utilize parameterized queries for production databases to prevent syntax errors and reduce security risks.
Free Microsoft Office alternative

Looking for a Free Office Suite? Try WPS Office

While Microsoft Access is used for complex relational databases, WPS Office provides a powerful, free alternative for handling documents, data-heavy spreadsheets, and presentations. Easily manage large datasets, run complex calculations, and format data reports with WPS Spreadsheet without needing intricate VBA programming.

  1. 1. Download the software: Visit the official WPS Office website and click 'Free Download' to get the installer for your operating system.
  2. 2. Install the suite: Run the downloaded setup file and follow the on-screen instructions to install the application.
  3. 3. Start managing your data: Open WPS Spreadsheet to import your data, apply powerful built-in filters, and manage records effortlessly.
Seamlessly open, edit, and save Microsoft Office formats like .docx, .xlsx, and .pptx.Robust spreadsheet functionalities for filtering, sorting, and analyzing data effortlessly.Lightweight architecture that runs smoothly across Windows, Mac, Linux, and mobile devices.Familiar user interface ensuring zero learning curve when switching from other Office suites.
microsoft office alternative - wps office

Frequently Asked Questions

Can I add a third combo box for a Yes/No field using this same VBA method?

Yes, you can easily add another unbound combo box for a Yes/No field. Simply add an additional 'If Not IsNull' block into your shared 'FilterMe' VBA procedure to evaluate the new combo box and append it to your existing WHERE string.

Why must the combo boxes be set as unbound?

Unbound combo boxes are not linked directly to a data source field in your table. This allows users to select values strictly for searching and filtering purposes without accidentally overwriting or modifying the actual database records.

How do I clear all the active filters and show all records again?

You can add a 'Clear Filters' command button to your form header. In its 'On Click' event, write VBA code to set all the combo boxes to 'Null', and then set 'Me.FilterOn = False' to reset the form and display all records.