zemp, that's how I do it also. This gives you also a chance to change the message, or even add your own errors (use a seperate funtion though)
I also pass the VbMsgBoxStyle enum, to receive an answer back in the caller as a VbMsgBoxResult enum:
Dim Ret As VbMsgBoxResult
Ret = ErrorMessenger(Err.Number, Err.Description, "Form1.MyProcedure", "Error Title"
If Ret = vbYes then
'Do This
Else if Ret = vbNo Then
'Do That
Else
'Do Nothing
End If
Public Function ErrorMessenger(pNumber As Long, pDesc As String, pProcedure As String, pTitle As String,Optional ByVal ButtonType As VbMsgBoxStyle) As VbMsgBoxResult
'Error handling here
'This is just something very basic
If Len(pDesc)=0 then
Select Case pNumber
Case 123
pDesc = "myDesciption"
End Select
End If
If ButtonType = vbYesNo Or ButtonType = vbYesNoCancel Then
ErrorMessenger =MsgBox (pNumber & "; " & pDesc & vbCrLf & vbLf & _
"In Procedure: " & pProcedure & ".",ButtonType , pTitle)
End If
End Function
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!