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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to "capture" run-time error ? 1

Status
Not open for further replies.

pdtit

Technical User
Nov 4, 2001
206
BE
Hi,

I created a button to do some tasks on my form; When I cancel the action, I receive the following error message :

Run-time error "2501"
The action was canceled.

How could I intercept this error and show the user a different errormessage which I create myself...

Regards,

Peter
 
Study the result of using some of the wizards, it's something along the lines of

[tt]private sub somecontrol_someevent()
on error goto myerror:
' the code

myexit:
exit sub
myerror:
if err.number=2501 then
msgbox "My Error Message"
else
msgbox err.description
end if

resume myexit
exit sub[/tt]

(alterations in bold)

Roy-Vidar
 
Roy-Vidar,

Fast and correct !! A star is won

Kind regards,

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top