Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > BOOK: Beginning Access 2003 VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Access 2003 VBA
This is the forum to discuss the Wrox book Beginning Access 2003 VBA by Denise M. Gosnell; ISBN: 9780764556593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Access 2003 VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 19th, 2007, 12:12 PM
Registered User
 
Join Date: Apr 2007
Location: Redwood Valley, CA, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Call Standard Module Error Handler from Form mod

I've followed Denise's instructions exactly, as far as I can tell, but "it" doesn't work. (Chap 2 - p 73-77; Case Study 1 - p 361 and following).

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

         (((NOTE: the first subform name below is misspelled - not supposed to be ...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 (per Denise's instructions in Chap 2), 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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference to a standard module Richard_Au_2008 Access VBA 3 November 4th, 2008 11:55 AM
Programmatically call onChange handler langdale Javascript How-To 1 September 3rd, 2007 10:24 AM
Call Standard Module Error Handler from From mod johndickerson VB Databases Basics 4 April 20th, 2007 02:53 PM
Event handler for moving a form tericson Access VBA 1 December 11th, 2006 04:16 AM
Parse error in error handler (Chapter 8) Funky Monk BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 August 6th, 2004 09:59 AM



All times are GMT -4. The time now is 08:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.