Stepping Through Code

By now you should be fairly comfortable with the design-time and runtime environments. Moreover, you may have discovered the break mode environment. As a refresher, the following bulleted list reviews each type of Access VBA environment.

• Design time is the mode by which you add controls to containers (such as forms) and write code to respond to events.

• The runtime environment allows you to see your program running the same way a user would. During runtime you can see all your Visual Basic code, but you cannot modify it.

• Break mode allows you to pause execution of your Visual Basic program (during runtime) to view, edit, and debug your program code.

The VBE allows you to step through your program code one line at a time. Known as stepping or stepping into, this process allows you to graphically see what line of code is currently executing as well as values of current variables in scope. Using function keys or menu items, you can navigate through program code with ease. For example, once in break mode, you can press the F8 key to skip to the next line.

During break mode, it is also possible to step over a procedure without having to graphically execute the procedure's statements one at a time. Known as procedure stepping or stepping over, this process can be accomplished during break mode by pressing Shift + F8 simultaneously.

There are times when you may wish to skip ahead in program code to a predetermined procedure or statement. The VBE provides this functionality through the use of breakpoints.

0 0

Post a comment