NoMatch Property Example (MDB)
The following example uses the NoMatch property to determine whether a FindFirst method process has been successful:
Function FindCountry() As Integer
Dim dbs As Database, rst As Recordset
Dim strCountry As String
' Return reference to current database.
Set dbs = CurrentDb
' Create dynaset-type Recordset object.
Set rst = dbs.OpenRecordset("Orders", dbOpenDynaset)
strCountry = InputBox("Please enter country name.")
rst.FindFirst "ShipCountry = '" & strCountry & "'"
If rst.NoMatch Then
FindCountry = False
Else
FindCountry = True
Debug.Print rst!OrderID
End If
rst.Close
Set dbs = Nothing
End Function