G
Guest
I have the following code attached to a form navigation button (nextRecord).
How do I change it so it displays a custom error message? When a user clicks
on the "Next Record" button, and there are no more records, instead of
getting the standard "You can't go to the specified record" error message, I
want it to say "There are no more records for this employee." I know I need
to make the change in the last 5 lines of code, but I'm having trouble with
the syntax.
Private Sub Next_Record_Click()
On Error GoTo Err_Next_Record_Click
DoCmd.GoToRecord , , acNext
Exit_Next_Record_Click:
Exit Sub
Err_Next_Record_Click:
MsgBox Err.description
Resume Exit_Next_Record_Click
End Sub
How do I change it so it displays a custom error message? When a user clicks
on the "Next Record" button, and there are no more records, instead of
getting the standard "You can't go to the specified record" error message, I
want it to say "There are no more records for this employee." I know I need
to make the change in the last 5 lines of code, but I'm having trouble with
the syntax.
Private Sub Next_Record_Click()
On Error GoTo Err_Next_Record_Click
DoCmd.GoToRecord , , acNext
Exit_Next_Record_Click:
Exit Sub
Err_Next_Record_Click:
MsgBox Err.description
Resume Exit_Next_Record_Click
End Sub