Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy Error Trap Question

Status
Not open for further replies.

gojohnnygogogogo

Programmer
May 22, 2002
161
GB
How can I trap and error and do something when that error appears ?

eg. when I get run time error 2220 then
display message "you have an error"

is this possible ?

thanks for any info.
 
Put On Error Goto in your procedure, e.g.

Sub Button1_Click
On Error Goto Err_Button1_Click
....
Code here
....
Exit Sub

Err_Button1_Click:
If Err.Number = 2220 Then
..Error Message here..
Else
..if different error occurs
End If
End Sub Have fun! :eek:)

Alex Middleton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top