How to Search a Microsoft Access Combo Box Using Two Fields
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.

- 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.
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.
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.
Open your Microsoft Access database, locate the target form in the navigation pane, right-click it, and select Design View.
Select the combo box you use for the search, press F4 to open the Property Sheet, and navigate to the Event tab.
Click the ellipsis (...) next to the After Update event and choose Code Builder to launch the Visual Basic for Applications (VBA) editor.
Enter the compound FindFirst condition using the AND operator. For example: Me.RecordsetClone.FindFirst "([PostCode] = '" & Me![cboPostCodeSearch] & "') AND ([CustomerName] = '" & Me![CustomerName] & "')".
Add the bookmark synchronization code immediately after the FindFirst statement: If Not Me.RecordsetClone.NoMatch Then Me.Bookmark = Me.RecordsetClone.Bookmark.
Save your VBA code, close the editor, switch the form back to Form View, and test the dual-field search.

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. Download the installer: Visit the official WPS Office website to download the free setup file for your Windows, Mac, or Linux operating system.
- 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. Open your existing files: Launch WPS Office to instantly open, edit, and safely save your existing Microsoft Word, Excel, and PowerPoint documents.

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.




