Stepping Over Procedures

Step Over button

If you don't want to step through the lines of code in a called procedure, you can step over the entire procedure by clicking Step Over on the Run menu (or clicking the Step Over button on the Visual Basic toolbar). The Step Over command is identical to the Step Into command except when the current statement contains a call to a procedure. The Step Into command steps into the procedure that was called and lets you step through it line by line, whereas the Step Over command executes the called procedure as a unit and then steps into the next statement in the calling procedure. In the following example, the current statement calls the procedure GetQueryCriteria.


GetQueryCriteria Criteria

If you choose the Step Into command, the Debug window displays the GetQueryCriteria procedure, and the first statement in that procedure is the current statement. The Step Into command is the best choice if you want to analyze the code within GetQueryCriteria.

If you choose the Step Over command, the module continues to display the calling procedure while Visual Basic executes the GetQueryCriteria procedure. Execution then advances to the statement immediately after the call to GetQueryCriteria. Step Over is a better choice than Step Into if you want to stay at the same level of code and you don't need to analyze how GetQueryCriteria works.

You can freely alternate between the Step Into and Step Over commands. The command you choose depends on which portions of code you want to analyze at any given time.