Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2002
    Posts
    44

    Unanswered: On Error Resume Next....what is the scope?

    as I finish and finally release this product, I want to make sure that if some odd, unforseen error occurs, it doesn't totally crap up the program and confuse the user.

    Therefore, I want to use the:
    On Error Resume Next

    code snippet.

    However, I'm not sure how much of the code that applies to.

    Does that apply to the entire project until I change the "On Error" statement, or does that apply just to the sub-routine it is run within?

    I would like to be able to make the statement one place and have it apply to the rest of my code.

    Thanks for the inputs.

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    it only applies to the current sub/function

    ...I might be the wrong person to answer this first but I'm the <never ever use on error resume next> kind of person. If you don't have the time to write some proper error handling code at least make some error handling showing a msgbox (maybe just there has been an error contact blabla) and LEAVING THE SUB/FUNCTION IN A SAFE WAY. I've seen cases where a db frontend wasn't working properly for 5 years and noone found the error (or better noone knew what the error actually was) for that time. Date just seemed to get "corrupted". You won't be able to track bugs nor ensure if an error occours your data integrity is kept intact. Think of some giant transaction, one part fails 'cause of a typo in the sql. You won't notice anything till you see your data being wrong! It would only need a few lines of code for the error handling:

    on error goto myerror:

    ...
    some nice code
    ...

    myexit:
    some nice garbage collection
    exit function
    myerror:
    msgbox err.description, vbcritical
    myworkspace.rollback
    goto myexit

    I hope you understand me, amen

  3. #3
    Join Date
    Apr 2002
    Posts
    44
    Apel I understand you 100% and agree with you 99%. However, I am in a bit of a unique situation. I'm in the military and currently deployed to Saudi Arabia. I'm leaving here in about a month, and it is highly unlikely that there will ever be anyone back in my current job who knows anything about a database besides "click here to run" because I'm not going to be around to fix problems, and neither will anyone else, I wanted to prevent some sort of typo from causing an uninformed user to panic.

Posting Permissions

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