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

How ti handle an error?

Status
Not open for further replies.

Gti

Programmer
Jul 23, 2001
99
PT
I have to care of a error
(eg in the specific case, i need to give a msgbox to the user saying that "Device is not present")
The error is number 68 ("Device not present")
How can i handle with this?
 
In your routine:

Public Sub MySub()
On error goto MyErrorHandler

'your code. If an error occurs it will drop into your error 'label below

Exit Sub
MyErrorHandler:
If err.Number = 68 Then
'Do stuff to handle error
msgbox "Device not present",vbcritical,"Device not found"
else
'do stuff to handle error or alert user
msgbox err.number & " " & err.description & " " & err.source
End if
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top