Results 1 to 6 of 6
  1. #1
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104

    Stopping code on fail

    Hi all,

    Seems I have messed up the VBA options settings, so now if a piece of code fails, it just stops. I'd like to return to the errant piece of code that caused the fail, so it gets highlighted and I can fix it. Is anyone able to tell me what to set in VBA options please?



    Thanks in advance, and I promise to stop playing around in there again

    Pete

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Comment out the code beginning with "On Error GoTo".

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I promise to stop playing around in there again
    Please don't keep that promise!!

    Error trapping and handling is an important part of VBA programming, as it allows you to take actions you want to have happen when an error occurs, rather than just letting Access stop with its own error message. There are times when you fully expect "errors" to occur as part of normal operations, and you want to able to deal with them.

    That said, when trying to debug an application, you can turn off all error handling. In the VBA code window, select Tools - Options from the menu.
    Click the General tab, then under Error Trapping, select the "Break on All Errors" option. This will deactivate all your On Error Go To... statements, so you don't have to make any changes to your code.

  4. #4
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104
    Hi John and Rawb

    There are no entries of On Error goto.... in my code. But, having said that I know from the past that the code should stop/break on the fail error, but mine just zooms to a halt with no indication of the break error. I am desperately trying to reinstigate the break on any error, to save hours of frustrating code searching! MOre help needed!

    chees
    Pete

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Have you tried compact and repair? It could be some corruption...
    Did you see John's post?

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    If your code is just stopping with no error message, and not giving you the option of debugging, that suggests that the problem is not a trappable run-time error. Instead, it may be a programming mistake which causes your code to run "normally" (i.e. without error messages) but not "correctly" (i.e. it isn't doing what you want it to), and those kinds of errors can be very hard to track down.

    What are the symptoms of code failure that you are getting? You are not getting error messages, so what happens, or does not happen, to indicate code failure?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 08-07-2014, 06:17 PM
  2. Stopping the F11 key.
    By dandoescode in forum Security
    Replies: 3
    Last Post: 06-26-2012, 08:06 AM
  3. Help Stopping AutoExec Macro
    By drewetzel in forum Access
    Replies: 2
    Last Post: 10-03-2011, 10:51 AM
  4. stopping a form from saving records
    By LAazsx in forum Forms
    Replies: 4
    Last Post: 12-09-2010, 05:48 PM
  5. Event Stopping - need help please
    By TG_W in forum Forms
    Replies: 3
    Last Post: 05-20-2010, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums