×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Getting Into Break Mode?

Getting Into Break Mode?

Getting Into Break Mode?

(OP)
I am attempting to learn to debug VBA code in Access. I believe I understand the use of the Immediate Window and the Local Window. I understand the use of the Debug.Print command.

Would someone please explain to me how to get Access into Break Mode in order to step through and execute the VBA code one line at a time to find a bug? I am aware that I can set a Break Point in the VBA code, go back to the Database Application itself and run it to a point that will jump to the desired point in the VBA code, hit the Break Point, and stop. Then I can go to the VBA editor and step through the code beyond my Break Point. This is all pretty cumbersome. But suppose I am in the VBA Editor at exactly the point I'd like to test. Is there any way that I can force Access into Break Mode at that point in the code and let me step through the code one line at a time beyond that point to debug the code? This would seem like the most efficient way go debug the code.

Thank you! An Access VBA novice would really appreciate your input.

RE: Getting Into Break Mode?

Hi,

Put your Break Point (and you can have multiple Break Points) where you need.

Run your code to the Break Point, test values and objects.

Then Step or Run to the next Break Point. Wash, rinse, repeat.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Getting Into Break Mode?

You may also find it very handy - in a Break Mode, the yellow line indicates the line of code to be executed. You can 'grab' the yellow arrow and move it up or down to re-execute a line of code, skip a line or two, or a few, correct your code and re-execute it again, etc.

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson

RE: Getting Into Break Mode?

I'm not sure how you would be able to stop the code "at exactly the point I'd like to test". Code just keeps running unless you for instance open a dialog form which I don't believe allows you to switch to the vba view.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Getting Into Break Mode?

A nice overview of VBE features you can find for instance here. Editor settings and watch window can be helpful in debugging too.

combo

RE: Getting Into Break Mode?

(OP)
Thank you very much for the references. I'll take a look.

Wayne, what I meant was that I know exactly which VBA code the Access Application will jump to and run at a certain time. By jumping into the VBA Editor, I can go to that exact Code point in that specific module. It would be nice to be able to step through that part of the code to see what some variables are doing.

Surprisingly, I find that, if my code of interest is located in a Standard Module, I can go to the code in that Module, hit CTRL+Break to enter Break Mode, and then step through the code line by line. If the code is located in the code that is associated with a Form, then this approach does not work. In that case I actually have to set a Break Point in the code, go back to the Database Application to get it to run that part of the code and stop at the Break Point, and only then can I step through the code line by line to see what some variables are doing. I don't know what the difference is.

RE: Getting Into Break Mode?

(OP)
Duane,

I do apologize for writing back to you and calling you "Wayne". It really was a typo.

Ron

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close