Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error Logging? ((a2k (9.0.6926) SP-3 Jet 4.0 SP-8) )

    I

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error Logging? ((a2k (9.0.6926) SP-3 Jet 4.0 SP-8) )

    At a quick glance, I don't see problems with the error logging itself, although personally, I would only use something like this if I really needed it, I find it too cumbersome for general use.

    But there's a syntax error in the UpdateFees procedure (apart from the irrelevant use of <!t>[pre]<!/t> and [t/pre[/pre]) - there is no Select Case ... line.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Error Logging? ((a2k (9.0.6926) SP-3 Jet 4.0 SP-8) )

    John

    In your error logging you capture the line number with Erl.

    That looks like a good idea, but when I look in help for Erl it is not there, and when I try to use it, I just get zero values.

    Is this something you have had to set up by doing something else?
    Regards
    John



  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Logging? ((a2k (9.0.6926) SP-3 Jet 4.0 SP-8) )

    John

    Check out the following:

    You can enter line numbers manually or use 3rd party code, MZ-Tools, Stephen Bullen's Smart Indenter, etc

    HTH

    John

    'Easily Implement VBA Error Handling
    'Prevent crashes and error messages by adding VBA error handling code to your
    'Microsoft Access applications.
    'By Mike Groh, technical editor
    'http://my.advisor.com/doc/15061

    'Duke of Erl

    'it 's important for you to know an error's location (module and procedure). Without
    'this information, it's nearly impossible to know what you're supposed to fix when an
    'error occurs.

    'Unfortunately, Microsoft doesn't make this task easy. There isn't a standard code
    'module property that provides the module's name, and no way to learn the name of
    'the procedure where the error occurred.

    'Although forms, reports, and class modules have a name property (Me.Name), the same
    'doesn't apply to standard code modules. This means you must provide the module name
    'yourself, as a literal string or as a constant. Personally, I prefer using a
    'module-level constant (mconModuleName) for this purpose, because it makes the error
    'handling code much easier to copy and paste. Similarly, I use a local constant
    '(conThisProcedure) to supply each procedure's name.

    'Using constants to identify the module procedure is another technique that makes it
    'easier to copy and paste error handling code.

    'Whenever possible, it 's nice know exactly which line triggered an error. Knowing the
    'line number can save you hours of time figuring out which statement in a 400 line
    'procedure is causing a problem. (Generally speaking, of course, it's a good idea to
    'keep procedures as short as possible, but sometimes it's difficult to break complex
    'processes into small procedures.)

    'VBA provides the Erl function to return the nearest line number before the statement
    'causing an error. This means you can find the exact location of the error, but only
    'if line numbers exist in the procedure. Unfortunately, line numbers aren't free.
    'As listing 1 shows, you must manually insert line numbers (1000, 2000, etc.) into your
    'procedures. Obviously, this can take a lot of time, so I don't normally bother with
    'numbering unless I know there's a problem in a procedure or anticipate problems at
    'some point.

    'A line number isn't executable. In fact, a line number is just a numeric label inserted
    'on blank lines in your procedures or separated from text on the line by a colon.

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Error Logging? ((a2k (9.0.6926) SP-3 Jet 4.0 SP-8) )

    Thanks I will experiment with this.

    I use both MZ Tools and Smart Identer, but I very aware that I use only a fraction of what they can do.
    Regards
    John



Posting Permissions

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