Set rst = db.OpenRecordset("tbl Customers", dbOpenDynaset)
' Find first matching record.
rst.FindFirst strCriteria
' Check if record is found.
If rst.NoMatch Then
'do this
Else
'do that
End If
rst.Close
Set db = Nothing
This example comes from Acc2K KnowledgeBase article
If ValidateKeyFields = True Then
varBHId = Me.cmbFind
'Find the record that matches the control
Me.RecordsetClone.FindFirst "[BatchNumber] = '" & varBHId & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.cmbFind.Value = Null
Else
Me.cmbFind.Value = Null
Exit Sub
End If
You can also use it in Acc2K by using DAO
Private Sub FindFirst_Click()
Dim rst As DAO.Recordset
Dim strCriteria As String
Set rst = Me.RecordsetClone
rst.FindFirst "[CompanyName] = 'B''s Beverages'"
If rst.NoMatch Then
MsgBox "No match was found."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.