Find Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that is based on a query and I want to create a button on the
form to find a particular record based on criteria that I input into a field
either in a message box or pop-up form. Can someone help me with the
docmd.find coding to accomplish this? Thanks in advance.
Steve S
 
Try this:

FindField is the Field you want to search, ie CustomerName
txtSearch is your search text field the user types into

Private Sub cmdFind_Click()
On Error GoTo err_Handler

FindField.SetFocus

If FindField.SelText = txtSearch Then
DoCmd.FindNext
Else:
DoCmd.FindRecord txtSearch, acAnywhere, , acSearchAll, , acCurrent
End If

err_Handler:
Exit Sub

End Sub
 
Back
Top