0

how this err.raise is working, when we are writing like
Err.Raise Err.Number, Err.source, Err.Description

what happends here?

where the errors are get captured?, where to find the err num,source and description?

thanks
subha

3
Contributors
2
Replies
7
Views
7 Years
Discussion Span
Last Post by AndreRet
0

Normally you Raise custom errors from a class and when you do so the error is pushed back to the calling function, which in turn should have an error handler to handle it.

As an example, here is something you could step through with F8...

Option Explicit

Private Sub Form_Load()

On Error GoTo Form_LoadError

RaiseMyError

Exit Sub
Form_LoadError:

MsgBox Err.Number & ":" & Err.Description & " in " & Err.Source
End Sub

Private Sub RaiseMyError()
Err.Raise vbObjectError + 1, "Form1", "This is a test of raising an error"
End Sub

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.