logo
search
Others

How to Use Recordset FindFirst and NoMatch in Access VBA

Khadija KhanKhadija Khan Oct 10, 2026 868 views

Question details

The user needs to know the correct way to check if a specific record was found after executing a FindFirst search on an Access form recordset.

How to Use Recordset FindFirst and NoMatch in Access
Product
Microsoft Access
Device & OS
not provided
Scenario
Searching for a specific topic using a combo box within a filtered continuous form recordset.
Observed behavior
Developers mistakenly check for the EOF (End of File) property, which does not accurately indicate if the FindFirst method successfully found a matching record.
Before you start

Ensure your Microsoft Access database is open and you have basic familiarity with writing VBA code for form recordsets.

Solution 1Recommended

Utilize the NoMatch Property to Verify FindFirst Results

Replace the EOF check with the NoMatch property to accurately determine if the FindFirst method located the desired record, and then synchronize the bookmarks.

When you use the FindFirst method in a Microsoft Access DAO recordset, the system does not use the EOF (End of File) marker to indicate a failed search. Instead, it utilizes the NoMatch property.

Using bookmarks is highly effective in this scenario because it positions the continuous form on a specific record while retaining the visibility of all other records, unlike a hard filter which hides non-matching records.

1
Execute the FindFirst method

In your VBA editor, run the FindFirst method on your RecordsetClone object based on the value selected in your combo box.

2
Evaluate the NoMatch property

Instead of checking 'If Not rs.EOF Then', change your code to test 'If Not rs.NoMatch Then'. This accurately verifies if the record was successfully found.

3
Synchronize form and recordset bookmarks

If the NoMatch property returns false (meaning a match was found), set the form's bookmark equal to the recordset's bookmark (e.g., Me.Bookmark = rs.Bookmark) to navigate directly to that record.

4
Handle unmatched records

If NoMatch evaluates to true, write an 'Else' statement to trigger a message box that notifies the user the selected topic is unavailable in the current filtered recordset.

Utilize the NoMatch Property to Verify FindFirst Results
Bookmark Advantage: By using a bookmark instead of a filter, your continuous form will successfully highlight the searched record while continuing to display all other available records in the list.
Free Microsoft Office alternative

Looking for a Lightweight Productivity Suite? Try WPS Office

While WPS Office does not include a database management tool like Access, it serves as a powerful, free alternative for all your primary document, spreadsheet, and presentation needs. Experience seamless performance with an intuitive interface.

Fully compatible with Microsoft Word, Excel, and PowerPoint file formatsLightweight installation that saves system resources and runs incredibly fastFamiliar tabbed user interface ensuring a seamless migration for new usersCompletely free core features for everyday productivity tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why shouldn't I use EOF with the FindFirst method?

The FindFirst method in DAO recordsets does not trigger the End of File (EOF) property when a search fails. Instead, it updates the NoMatch property. Checking EOF will lead to inaccurate results and potential VBA runtime errors.

What is the difference between applying a filter and using a bookmark?

Applying a filter restricts the form's recordset to only display records that meet the specified criteria, hiding everything else. Using a bookmark simply navigates the form to a specific record while leaving all other records visible.

What happens to the current record if NoMatch is true?

If NoMatch is true, the FindFirst method did not find a matching record. The current record position in the recordset becomes undefined or remains at its previous state. Always handle this scenario by alerting the user.