Strange Problem With SetOption/GetOption

M

MikeC

Earlier this evening, I discovered that my breakpoints
completely stopped working in one of my AXP databases. I
could no longer debug code.

I looked to see if I clicked the wrong button by mistake.
That wasn't it, so I restarted my machine. That didn't
fix it. I compacted and repaired. I decompiled and
recompiled. None of these had any effect.

After retracing my steps, I found that the cause was a new
function I was running during the Open event of my
switchboard form that opens during startup. My function
gets the original values of some Access options, saves
them in public variables, and then temporarily sets the
options the way I want them to be. Later, when the
database is closed, I restore the original options.

The function appears to work fine and without errors.

Anyway, I found that when I commented-out this new
function, I was able to set breakpoints and resume
debugging my code.

The strange thing is that I *UN-commented* the function
without making any programmatic changes to see what would
happen. My breakpoints continued to work correctly.

Now I'm wondering if the source of the problem has
something to do with the below note I found in the online
VBA help.

"Set Options from Visual Basic" (toward bottom of page)

"Note If you are developing a database application, add-
in, library database, or referenced database, make sure
that the Error Trapping option is set to 2 (Break On
Unhandled Errors) when you have finished debugging your
code."

I have not seen this option in VBA and had believed that
my error handling (On Error GoTo ...) would detect any
runtime errors. Is this not true? Has anyone observed
the above problem in Access VBA?
 
M

MikeC

Well, I found the option mentioned in my original post on
the General tab in VBA options and found that I had
already correctly set it to "Break On Unhandled Errors,"
so that isn't the source of the problem.

Ideas anyone?
 
A

Allen Browne

Mike, I believe it is a corruption when this happens, even though your
decompile and compact did not fix it.

Make sure Name AutoCorrect is off. Compact again. Turn off Compile on Demand
(options from Code window).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top