Try something like this:
Private Sub cboOrgs_AfterUpdate()
'On Error GoTo HandleError
Dim strPrcdrName As String
Dim strModName As String
strPrcdrName = "cboOrgs_AfterUpdate"
strModName = Application.CurrentObjectName
Debug.print Me.subfrmctrlFinRpt.ControlType
Debug.print Me.subfrmctrlFinRpt.Form!cboIS_BySrv_List
Exit_Handler:
Exit Sub
HandleError:
Stop
GenErrHand Err.Number, Err.Description, strModName, strPrcdrName
Resume Exit_Handler
End Sub
If the subform control is actually named subfrmctrlFinRpts (i.e. with a
trailing S), the code should not compile. Make sure the Name AutoCorrect
boxes are unchecked, and compact the database, and see if it still compiles.
If it compiles and runs okay, then you have something else on the form named
subfrmctrlFinRpt.
If it gives the error, you can remove the single quote from line 1, i.e.:
On Error GoTo HandleError
It should then go to the error handler. Press F8 to trace the code through
your error hander routine.
(BTW, I'm not sure Application.CurrentObjectName is a good idea. If the code
is called from another routine it may return the active form instead of the
form that actually has this code in its module.)
HTH.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"John D" <(E-Mail Removed)> wrote in message
news:927EEF40-5C70-459A-9240-(E-Mail Removed)...
> 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)
>
> (I'd put the code in here, but this Sub isn't even being "called" -
> that's
> the problem)
>
> 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 purposefully misspelled -
> not supposed to be ...FinRpt..., but 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
>
> 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 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 isn't my Error Handler being "called" correctly? Thanks
>
> John D