G
Guest
I've followed 2 books exactly, as far as I can tell, but "it" doesn't work.
I have in a Standard Module [modBusinessLogic]:
_____________________________
' General Error Handler to be called from most procedures
Public Sub GenErrHand(lngErrNumber As Long, strErrDesc As String,
strModuleSource As String, strProcedureSource As String)
Dim strMessage As String
strMessage = "An error has occured. Please report this info:" & _
vbCrLf & "Error Number: " & lngErrNumber & _
vbCrLf & "Description: " & strErrDesc & _
vbCrLf & "Module: " & strModuleSource & _
vbCrLf & "Procedure: " & strProcedureSource
MsgBox strMessage, vbCritical
End Sub
_________________________
I have in a Form's Module [Form_FA1_OrgMaster_All]:
_________________________
Private Sub cboOrgs_AfterUpdate()
On Error GoTo HandleError
' Populates a combo box on the Financial Reports subform with reports titles
for the Org just chosen
(((NOTE: the first subform name below is misspelled - not
....FinRpt..., rather ...FinRpts... - this sets up an error to test Error
Handler)))
Me.subfrmctrlFinRpt!cboIS_BySrv_List = Null
Me.subfrmctrlFinRpts!cboIS_BySrv_List.Requery
... More Code ...
Exit Sub
HandleError:
Dim strPrcdrName As String
strPrcdrName = "cboOrgs_AfterUpdate"
Dim strModName As String
strModName = Application.CurrentObjectName
Call GenErrHand(Err.Number, Err.Description, strModName, strPrcdrName)
Exit Sub
End Sub
_________________________
When I tested (with the Immediate Window) the Error Handler with a procedure
in the Standard Module that would create an error, it "worked". That is, it
produced the Message Box I want.
But when I test it with the set up above (chosing an Organization in the
Combo Box on the form), instead of getting the Message Box I want, I get
"Compile Error: Method or data member not found" - which is obviously the
regular VBA Message Box.
Why don't I get the Message Box from my Error Handler? Thanks
John D
I have in a Standard Module [modBusinessLogic]:
_____________________________
' General Error Handler to be called from most procedures
Public Sub GenErrHand(lngErrNumber As Long, strErrDesc As String,
strModuleSource As String, strProcedureSource As String)
Dim strMessage As String
strMessage = "An error has occured. Please report this info:" & _
vbCrLf & "Error Number: " & lngErrNumber & _
vbCrLf & "Description: " & strErrDesc & _
vbCrLf & "Module: " & strModuleSource & _
vbCrLf & "Procedure: " & strProcedureSource
MsgBox strMessage, vbCritical
End Sub
_________________________
I have in a Form's Module [Form_FA1_OrgMaster_All]:
_________________________
Private Sub cboOrgs_AfterUpdate()
On Error GoTo HandleError
' Populates a combo box on the Financial Reports subform with reports titles
for the Org just chosen
(((NOTE: the first subform name below is misspelled - not
....FinRpt..., rather ...FinRpts... - this sets up an error to test Error
Handler)))
Me.subfrmctrlFinRpt!cboIS_BySrv_List = Null
Me.subfrmctrlFinRpts!cboIS_BySrv_List.Requery
... More Code ...
Exit Sub
HandleError:
Dim strPrcdrName As String
strPrcdrName = "cboOrgs_AfterUpdate"
Dim strModName As String
strModName = Application.CurrentObjectName
Call GenErrHand(Err.Number, Err.Description, strModName, strPrcdrName)
Exit Sub
End Sub
_________________________
When I tested (with the Immediate Window) the Error Handler with a procedure
in the Standard Module that would create an error, it "worked". That is, it
produced the Message Box I want.
But when I test it with the set up above (chosing an Organization in the
Combo Box on the form), instead of getting the Message Box I want, I get
"Compile Error: Method or data member not found" - which is obviously the
regular VBA Message Box.
Why don't I get the Message Box from my Error Handler? Thanks
John D