Trap all your errors
Use an MDE
Switch to storing your values in controls on a hidden form
Or use self-healing functions and class modules that will
re-initialize themselves upon a code reset.
My philosophy is that public variables of whatever type should never
be used for any purpose except buffering data that is looked up from
somewhere. This would be configuration data, user name, and so forth
-- all things that can be easily re-initialized should the data be
zeroed out. Public variables should never be used for passing data
between Access objects. There are a number of better options for
that, including OpenArgs, reading the data directly from the other
object, or using a class module as a data structure for storing
numerous data points.
I tend to do the latter for report filtering, for instance, so that
all the reports depend on the same class module and do the filtering
specific to a particular report in the report's OnOpen event. The
class module is populated from various dialog forms specific to the
attributes being filtered. This makes everything independent of
everything else -- the class module doesn't have to know anything
about either the dialog forms or the reports, and the forms and
reports don't need to know anything about each other. The forms
interact with the class module instance, and the reports interact
with the class module instance.
I find this kind of approach very easy to work with in this context.
It's not so easy for other contexts, nor for simple operations, and
I don't always use it. But it certainly makes complicated projects
easy and maximizes code re-use.