I have one class and one main program which calls that class. In the class, I have trap for an error and use Err.Raise method to fire the error to the main program, but it doesn't work so far.

Any idea? Thanks

Code:
Public Function GetRPData() As ADODB.Recordset
        On Error GoTo errHandler

        'My code...bla..bla..bla...

        Err.Raise vbObjectError + 1000, "Mycode.Mycode", "My own error."

    End If
    Exit Function
    
errHandler:
   'In case there is another error that is generated by system or provider
    Err.Raise Err.Number, Err.Source, Err.Description
End Function


'*******************Code in the main program
Private Sub Form_Load()
   On Error GoTo errHandler

   'My code and declaration......

    Exit Sub
    
errHandler:
    MsgBox Err.Number & "  " & Err.Description
End Sub