replacing default messagebox

A

Al

A quick and dirty way to achieve this is to replace the
message box that would normally come up in the code. For
example, I had a previous record button on a form that
would give a default message when the user tried to go
back past the first record. Below is the code with the
default message commented out and my custom message to
replace it:

Private Sub Prev_Click()
On Error GoTo Err_Prev_Click

DoCmd.GoToRecord , , acPrevious

Exit_Prev_Click:
Exit Sub

Err_Prev_Click:
MsgBox ("You are at the first record")
'MsgBox Err.Description -- COMMENTED OUT LINE
Resume Exit_Prev_Click

End Sub

HTH,
Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top