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

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.