ACC2002: Breakpoints Are Ignored in Visual Basic for Applications Code (299257)



The information in this article applies to:

  • Microsoft Access 2002

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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Open the sample database Northwind.mdb.
  2. Click the Forms object, and then click New.
  3. Click Design View, and then click OK.
  4. On the View menu, click Code.
  5. 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
    					
  6. Close the Visual Basic Editor (VBE).
  7. Save the form as TestBreakpoint, and then close the form.
  8. On the Tools menu, click Startup.
  9. If the Use Special Access Keys check box is selected, clear it.
  10. Click OK to close the Startup dialog box.
  11. Close and then reopen the database.
  12. Open the TestBreakpoint form in Design view.
  13. On the View menu, click Code.
  14. Click the grey vertical bar next to i = 1 to add a breakpoint.
  15. Close the Visual Basic Editor.
  16. On the View menu, click Form View.
Note that the code runs and displays the message box, instead of pausing at the breakpoint, as you would expect.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbprb KB299257