Microsoft KB Archive/299257

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

Article ID: 299257

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q299257



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
Enable the Use Special Access Keys startup option. To do so, follow these steps:
 * 1) Open the database in which the breakpoint has been set.
 * 2) On the Tools Menu, click Startup.
 * 3) In the Startup dialog box, click to select the Use Special Access Keys check box.
 * 4) Click OK to close the Startup dialog box.
 * 5) Close and then reopen the database.
 * 6) Run the code that contains the breakpoint. Note that execution of the code pauses at the breakpoint, as you would expect.



Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb. Click the Forms object, and then click New. Click Design View, and then click OK. On the View menu, click Code.  Type or paste the following code into the class module of the form: Private Sub Form_Load Dim i As Integer i = 1 MsgBox Str(i) End Sub </li> Close the Visual Basic Editor (VBE).</li> Save the form as TestBreakpoint, and then close the form.</li> On the Tools menu, click Startup.</li> If the Use Special Access Keys check box is selected, clear it.</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 grey 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 displays the message box, instead of pausing at the breakpoint, as you would expect.

Additional query words: prb

Keywords: kbprb KB299257

-

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

© Microsoft Corporation. All rights reserved.