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

Error Numbers 1

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
Can I get an error number somehow, that I can put in a procedure?

Err_AddClip_Click:
MsgBox Err.Description
Resume Exit_AddClip_Click

Thanks
 
Err.Number?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Many thanks, easy when you know how.

Is there a certain place in the code where a trap is set?

Private Sub Cancel2_Click()

On Error GoTo Err_Cancel2_Click

Exit_Cancel2_Click:
Exit Sub


Err_Cancel2_Click:
MsgBox Err.Number
Resume Exit_Cancel2_Click
End Sub


The code ommited in this event generates a code of 8002.

Thanks
 
Your On Error Goto statement tells the code where to go (to your handler) if it encounters an error during execution. If an error occurs (seems you've got a handler for it) the code will break from it's execution at the line (which if you really want for some reason you can get with the use of the Erl() function) where it errors and jump to the specified error handling routine you supplied in the On Error Goto statement.

So, in short, the error is trapped at the line it's encountered and it's handled where you tell it to be.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
You're welcome, glad I could help [smile]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top