Microsoft KB Archive/296848

= ACC2000: Breakpoints Are Ignored in Visual Basic for Applications Code =

Article ID: 296848

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q296848



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you add a breakpoint to a Visual Basic for Applications (VBA) procedure or function, the breakpoint is ignored and the code runs to completion without pausing, as you would expect.



CAUSE
This behavior is by design and occurs when the Advanced Startup option, Use Special Access Keys, is disabled.



RESOLUTION
Use the keyword Stop instead of a breakpoint to halt execution of the code at a specific point.

-or-

Enable the Use Special Access Keys option in the Startup dialog box. To do so, follow these steps:
 * 1) Open the database in which the breakpoint has been set.
 * 2) On the Tools menu, click Startup, and then in the Startup dialog box, click Advanced.
 * 3) Click to select the Use Special Access Keys check box.
 * 4) Close the Startup dialog box.
 * 5) Close and then re-open the database.
 * 6) Run the code that contains the breakpoint. Note that execution of the code pauses as expected at the breakpoint.



Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb. Click Forms under Objects, and then click New. In the New Form dialog box, click Design View, and then click OK. On the View menu, click Code.  Type or paste the following code into the form's class module: Private Sub Form_Load Dim i As Integer i = 1 MsgBox Str(i) End Sub </li> Close the Visual Basic Editor.</li> Save the form as TestBreakpoint, and then save it.</li> On the Tools menu, click Startup.</li> Click Advanced, and then click to clear the Use Special Access Keys check box if it is selected.</li> Click OK to close the Startup dialog box.</li> Close and then reopen the database.</li> Open the TestBreakpoint form in Design view.</li> On the View menu, click Code.</li> Click the gray vertical bar next to i = 1 to add a breakpoint.</li> Close the Visual Basic Editor.</li> On the View menu, click Form View.</li></ol>

Note that the code runs and presents the message box instead of pausing at the breakpoint as you would expect.

Additional query words: prb

Keywords: kbprb KB296848

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.