Solved

Handled error break hammers local storage

Posted on 2011-09-23
3
229 Views
Last Modified: 2012-06-21
I am enccountering something that has been evolving from a simple annoyance to a problem that I will have to deal with.
I am working in Access 2007/accdb for clients (although I have 2010 32 bit on my home machine).
If my apps break on a handled error, it appears to hammer many, if not all, of my public variables and custom classes.
This is a PITA for me while developing, since I find that I have to close the app and then re-open it to reinitialize the objects. In production it means that a user should probably close and then re-open the app if they ever get an error message; which lacks grace.
I incorporate message handling in every subroutine and function except class modules, where I apply situational discretion as to how an error is handled. I have a public HandleError function that takes care of the paperwork.
My default is to have my errors break in class modules, which I enforce when I open the app with the following:

      Application.SetOption "Error Trapping", enmBreakInClassModules

Is this normal behavior? For some reason I don't recall this being as much of an issue in years past. My impression is that this is something that has come more to the fore in 2007 and 2010.
0
Comment
Question by:shambalad
  • 2
3 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 36587600
<<If my apps break on a handled error>>

  If you reset at that point (stop execution), everything clears.  That's no different then it always has been.

Jim.
0
 
LVL 7

Author Comment

by:shambalad
ID: 36587682
I think this is happening even if I don't do a reset; but, to be honest, I'm not sure (knowing myself, you've probably identified what it is I've been doing).
So...
I'm going to accept your answer, and keep your advice in mind. If my experience differs. I will revisit.
Thanks,
Todd
0
 
LVL 57
ID: 36587765
Todd,

<<I think this is happening even if I don't do a reset; but, to be honest, I'm not sure (knowing myself, you've probably identified what it is I've been doing). >>

  It should not be happening if you are not resetting.  Simply breaking execution is a pause (you have a breakpoint on the line, have told VBA to break, or have a STOP in the code).

  When your at a break, you can hit F8 to step through code line by line or F5 to simply continue.

  But if you do Run/Reset off the menbar or hit the Square on the toolbar, then your resetting executiona nd everything will clear.

Jim.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create a calculated date column, ignoring weekends 6 32
Access Database 5 44
MS Access question 3 42
access to sql migration 5 23
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question