Step through code

  • Thread starter Thread starter Stephanie
  • Start date Start date
S

Stephanie

Hi. I posted earlier about a loop I can't seem to get
through. There is chance to debug (no error type, just
an Access msg box).
How can I step through my code to see where I am, so I
can see the values assigned and maybe determine why I'm
not making it all the way through. Arg!! I realize as a
newbie I write terrible code, but this is the last big
thing I need to fix. Thanks, Stephanie
 
Select the line you want to break on, then Debug, Toggle Breakpoint (or F8).

It'll stop at that line... then continue stepping through with F8.... or
continue to the next breakpoint with F5.

When you're doing that, then the immediate window (which lets you evaluate
expressions given the current context) and the locals window (both from the
view menu) are your friends.
 
Rob's answer is good, but just as a note, if using a recent version (5 or 6
upwards methinks), if you click to the side of your code, in the long gray
box, a red circle will appear, and the line itself will turn a deep red. This
means that a 'breakpoint' has been set.
Once your code reachs this point, it will stop, and bring you to your code
window. The program will freeze in the background, and as a simple way of
checking variables, holding your cursor over any variable name will show its
value. This is useful, to see where your code is going wrong (for example, if
something contains a null value where it shouldn't).

You can then re-start your code by pressing the 'Play' (Blue triangle)
Button near the top of your screen. And as an alternative to
step-by-stepping, you can simply set multiple breakpoints, and quickly run
through the points where you think things are going wrong.

Hope that helps!
 
Back
Top