Operating System - Microsoft
1761022 Members
4271 Online
108897 Solutions
New Discussion юеВ

Re: VBA code in Access 2000 only works in debugger

 
Dan Stauffer
New Member

VBA code in Access 2000 only works in debugger

I have some code that only works when I
"slow it down" by stepping through it in debugger w/ breakpoints inserted. The code seems to skip steps when I try to run it normally. Any idea why this is happening???
3 REPLIES 3
Jon Finley
Honored Contributor

Re: VBA code in Access 2000 only works in debugger

You may not be initializing some of your variables properly, or may not be passing the value correctly. Some debuggers initialize all variables rather than leave them as "undefined".

Create a "debug" window, place screen write points rather than breakpoints and run the program normally, collecting the variable changes in the window (or output to a printer or logfile).

Jon
"Do or do not. There is no try!" - Yoda
Jorge Pinto Leite
Respected Contributor

Re: VBA code in Access 2000 only works in debugger

Dan, there are some VBA code that simply doesn't work if used without debugger. Let me explain better: suppose you have a report printer from a form, and you want to alter it's activate behaviour according to a variable in the form. Forget it. In debug mode you'll be able to do it. But not in "normal" mode.
Jorge
Laurence Wingerter
Occasional Advisor

Re: VBA code in Access 2000 only works in debugger

Dan,
Sometimes today's machines are too fast. I've seen this before expecially when the code consists of various calls to other subroutines. Some commands invoke system routines that are multi-step.
Try injecting some "DoEvents" if there are places in the code that might fit what I have descibed. That'll give the system a chance to finish before continuing.