Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Breakpoints Are Ignored in Visual Basic for Applications Code


View products that this article applies to.

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).

↑ Back to the top


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.

↑ Back to the top


Cause

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

↑ Back to the top


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.

↑ Back to the top


More information

Steps to Reproduce the Behavior

  1. Open the sample database Northwind.mdb.
  2. Click Forms under Objects, and then click New.
  3. In the New Form dialog box, click Design View, and then click OK.
  4. On the View menu, click Code.
  5. 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
    					
  6. Close the Visual Basic Editor.
  7. Save the form as TestBreakpoint, and then save it.
  8. On the Tools menu, click Startup.
  9. Click Advanced, and then click to clear the Use Special Access Keys check box if it is selected.
  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 gray 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 presents the message box instead of pausing at the breakpoint as you would expect.

↑ Back to the top


Keywords: KB296848, kbprb

↑ Back to the top

Article Info
Article ID : 296848
Revision : 4
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 257