Others

How to Search a Microsoft Access Combo Box Using Two Fields

Elise WilliamsElise Williams Nov 3, 2026 868 views

Question details

The user needs to identify and locate a specific record from a combo box in Microsoft Access using two criteria, such as a postcode and a customer name, because multiple records share the same value for the first criterion.

How to Search a Microsoft Access Combo Box Using Two Fields
Product
Microsoft Access
Device & OS
not provided
Scenario
Filtering or searching for specific database records in an Access form when multiple records have identical primary search values (e.g., same postcodes).
Observed behavior
A single-field combo box search returns ambiguous results when there are duplicate values, requiring a dual-field search setup to accurately pinpoint the correct record.
Before you start

Ensure you know the exact field names used in your Access database tables. Avoid using reserved words like 'Name' for your table, field, or variable names to prevent syntax errors.

Solution 1Recommended

Use a Compound FindFirst Condition in VBA

Apply a VBA macro on the combo box's AfterUpdate event to search for a record matching two distinct fields.

By combining two fields using the 'AND' operator in your RecordsetClone.FindFirst statement, Access will locate the specific record that matches both criteria simultaneously, eliminating the issue of duplicate values.

1
Open the form in Design View

Open your Microsoft Access database, locate the target form in the navigation pane, right-click it, and select Design View.

2
Access the combo box properties

Select the combo box you use for the search, press F4 to open the Property Sheet, and navigate to the Event tab.

3
Open the VBA Code Builder

Click the ellipsis (...) next to the After Update event and choose Code Builder to launch the Visual Basic for Applications (VBA) editor.

4
Enter the compound condition

Enter the compound FindFirst condition using the AND operator. For example: Me.RecordsetClone.FindFirst "([PostCode] = '" & Me![cboPostCodeSearch] & "') AND ([CustomerName] = '" & Me![CustomerName] & "')".

5
Synchronize the bookmark

Add the bookmark synchronization code immediately after the FindFirst statement: If Not Me.RecordsetClone.NoMatch Then Me.Bookmark = Me.RecordsetClone.Bookmark.

6
Save and test

Save your VBA code, close the editor, switch the form back to Form View, and test the dual-field search.

Use a Compound FindFirst Condition in VBA
Syntax Check for Data Types: Ensure that text values are enclosed in single quotes within your VBA string. If your fields contain numeric data instead of text, omit the single quotes around the combo box values.
Free Microsoft Office alternative

Managing Office Data? Switch to the Free WPS Office Suite

While WPS Office does not include a direct database application like Microsoft Access, it serves as an excellent, free, and lightweight alternative for your daily document, spreadsheet, and presentation needs. Experience high compatibility and a seamless workflow without the heavy subscription fees.

  1. 1. Download the installer: Visit the official WPS Office website to download the free setup file for your Windows, Mac, or Linux operating system.
  2. 2. Install the software: Run the downloaded installer and follow the quick on-screen instructions to set up the office suite on your computer.
  3. 3. Open your existing files: Launch WPS Office to instantly open, edit, and safely save your existing Microsoft Word, Excel, and PowerPoint documents.
Fully compatible with Microsoft Office formats (.docx, .xlsx, .pptx).Lightweight design that runs smoothly even on older or low-spec computers.Familiar, intuitive user interface makes switching from Microsoft Office seamless.Includes a powerful built-in PDF toolkit for reading, editing, and converting files.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use more than two fields in an Access FindFirst search?

Yes, you can chain multiple conditions together using the 'AND' operator in your VBA FindFirst string, allowing you to match a combination of postcode, customer name, phone number, and more.

Why am I getting a syntax error with my FindFirst condition?

Syntax errors in FindFirst conditions often occur due to mismatched or missing quotes. Text fields require single quotes around the search criteria (e.g., [Field] = 'Value'), whereas numeric fields do not need quotes (e.g., [Field] = Value).

What are reserved words in Microsoft Access?

Reserved words are specific terms like 'Name', 'Date', 'Select', or 'Value' that Access uses for its internal operations and SQL queries. Using them as table or field names can cause unexpected syntax errors and should always be avoided.