Hello-
I was wondering if someone would be willing to help me put together code for a form button. I want the button to go to a record that is typed into a text box based on the key field of a query. If there is no key that matches then I would like to have a message say someting like "record does not exist" Below is my code without any message for entries that do not match the text box. Any ideas???
Private Sub Command2_Click()
On Error GoTo error_msg
Me.id_list.Requery
DoCmd.OpenForm "mainsubform", acNormal, , "[key] = " & Me.id_form_text
Exit Sub
error_msg:
MsgBox "Record does not exist."
Exit Sub
End Sub
I was wondering if someone would be willing to help me put together code for a form button. I want the button to go to a record that is typed into a text box based on the key field of a query. If there is no key that matches then I would like to have a message say someting like "record does not exist" Below is my code without any message for entries that do not match the text box. Any ideas???
Private Sub Command2_Click()
On Error GoTo error_msg
Me.id_list.Requery
DoCmd.OpenForm "mainsubform", acNormal, , "[key] = " & Me.id_form_text
Exit Sub
error_msg:
MsgBox "Record does not exist."
Exit Sub
End Sub