I created a form that allows users to enter a record name (which also happens to be the primary key) in a text box and then click a button which opens a data entry form and automatically goes to the record that the user entered. I used the following code that takes advantage of the DoCmd.open form OpenArgs property:
Private Sub btnFind_Nest_Click()
Dim recordtolocate As String
recordtolocate = [Forms]![findNest]![full_ID]
DoCmd.OpenForm "frmHatch_Success", , , "Full_Nest_ID= '" & recordtolocate & "'"
DoCmd.Close acForm, "FindNest", acSaveNo
End Sub
I am wondering if there is something I can do so a message box will appear if there is no record match (e.g. the user enters a typo). Currently, if there is no match the form will open to a new record.
I am also open to using a different method to open the form if it facilitates incorporating an error message.
Thanks for your help.