Others

How to Add Search and Reset Buttons to an Access Continuous Form

Olivia MillerOlivia Miller Nov 3, 2026 868 views

Question details

The user wants to add functional Search and Reset buttons to a Microsoft Access continuous form to filter records across multiple fields.

How to Add Search and Reset Buttons to an Access Continuous Form
Product
Microsoft Access
Device & OS
not provided
Scenario
Designing a user interface in a database where users need to search for specific records across multiple columns on a continuous form without opening secondary duplicate forms.
Observed behavior
The user needs to dynamically apply and clear form filters using VBA based on an unbound search text box.
Before you start

Ensure your Access form's Default View is set to 'Continuous Forms' and that you have added an unbound text box for user input, along with two command buttons for Search and Reset.

Solution 1Recommended

Use VBA to Dynamically Apply Form Filters

Add a VBA script to the On Click events of your Search and Reset command buttons to adjust the form's Filter property.

By modifying the 'Me.Filter' property, you can search multiple fields at once within the same continuous form. This method avoids the need to build duplicate forms or complex subqueries.

1
Open the form in Design View

Right-click your continuous form in the Navigation Pane and select 'Design View'.

2
Add VBA to the Search button

Select your Search button, open the Property Sheet, navigate to the Event tab, and select '[Event Procedure]' for the 'On Click' event. Click the ellipsis (...) to open the VBA editor.

3
Insert the Search filter code

Enter the following code, replacing 'SearchTextBox' with your text box name and 'Field1' with your actual field names: Dim strWhere As String, strValue As String strValue = Me.SearchTextBox If strValue = "" Then Exit Sub strWhere = "[Field1] Like '*" & strValue & "*' OR [Field2] Like '*" & strValue & "*'" Me.Filter = strWhere Me.FilterOn = True

4
Configure the Reset button

Select the Reset button, create a new '[Event Procedure]' for its On Click event, and enter the following code to clear the filter: Me.Filter = "" Me.FilterOn = False Me.SearchTextBox = ""

Use VBA to Dynamically Apply Form Filters
Expanding the Search: You can add as many fields as you need to the 'strWhere' string by appending additional 'OR [FieldName] Like...' clauses. Alternatively, you can modify the form's RecordSource by constructing a complete SQL string.
Free Microsoft Office alternative

Streamline Your Data and Documents with WPS Office

While Microsoft Access is used for database management, WPS Office provides a free, lightweight, and highly compatible alternative for your daily document processing, spreadsheet data filtering, and presentation needs. It fully supports standard Microsoft Office formats with a familiar interface.

Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Advanced spreadsheet filtering and data processing tools for robust data management.Lightweight design ensuring fast startup and smooth operation.Completely free to use with a familiar, ribbon-style user interface for zero learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Can I search all fields in an Access form at once without typing out every field name?

Using the standard VBA Filter property, you generally must specify each field in the WHERE clause (e.g., [Field1] Like '*text*' OR [Field2] Like '*text*'). While you can write a loop in VBA to iterate through all form controls, explicitly declaring the fields is more reliable and performs better.

Why isn't my continuous form updating when I click the Search button?

Ensure your VBA code includes the command 'Me.FilterOn = True' after defining the 'Me.Filter' string. Without this command, Access stores the filter criteria but does not apply it to display the matching records.

Does this VBA filter method work if my form is based on a query instead of a table?

Yes, adjusting the Filter property works identically whether the continuous form's Record Source is a direct table or a query. Just ensure that the field names you reference in the VBA code match the columns outputted by the query.