Results 1 to 2 of 2

Thread: Error trapping

  1. #1
    Join Date
    Feb 2004
    Chicago, IL

    Unanswered: Error trapping

    If an error is trapped in code, does anyone know how to tell what function, module, and/or line the error actually occured on? I have been using global variables and setting them as I enter a function and/or new module but that gets a little tedious. Also I have to be careful to remember when I cut and paste code. Thanks in advance.

  2. #2
    Join Date
    Dec 2003

    Naming convention in error handling

    I have encountered this with same type of thing with some apps I have wrote. What I have taken on the habit of doing is for each module or class object declaring a const

    Const MODULE_NAME = "This is my module"

    Then for each subroutine or function

    private Const METHOD_NAME = "This does something"

    Then in your error trapping you can construct your message box

    msgbox "There was an error with " & module_name & ": " & method_name & vbcrlf & err.number & ": " & err.description

    This will let you know where the error occurs etc.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts