Article ID: 275087 - Last Review: November 18, 2004 - Revision: 3.1

The Stop statement in an Access 2000 database does not work in Access 2002

This article was previously published under Q275087
Moderate: Requires basic macro, coding, and interoperability skills.

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

Expand all | Collapse all

SYMPTOMS

The Stop statement, which suspends the Visual Basic for Applications (VBA) code in a Microsoft Access 2000 database, no longer works when you use the same database in Access 2002.

CAUSE

Access 2002 cannot go into break mode with code that has been compiled in Access 2000. A Stop statement is ignored, just as the same statement would be ignored in an Access *.mde file.

RESOLUTION

If you open the Visual Basic Editor in Access 2002, the code will be decompiled, allowing the Stop statement to resume its functionality as it did in Access 2000 (that is, suspend code execution). Therefore, open and close the Visual Basic Editor in Access 2002 before running the code.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. In Access 2000, create a new database, and then save it as Db1.mdb.
  2. In the new database, create a new form.
  3. Add a command button to the form, and then assign the following VBA code to the Click event of this button:
    Private Sub Command0_Click()
        MsgBox "You should ALWAYS get this message box."
        Stop
        MsgBox "You should NEVER get this message box."
    End Sub
    					
  4. Close the Visual Basic Editor, and then switch the form to Form view.
  5. Click the command button, and then click OK in the message box. You should now be back in the Visual Basic Editor, and the Stop statement should be highlighted.
  6. Close the Visual Basic Editor, and then click OK to stop the debugger.
  7. Close the form and save it as Form1.
  8. Quit Access 2000, and then open Db1.mdb in Access 2002.
  9. Open the Form1 form, and then click the command button. Note that you receive the first message box.
  10. Click OK in the message. Instead of the code being opened in suspend mode, note that you get the second message box.

APPLIES TO
  • Microsoft Access 2002 Standard Edition
Keywords: 
kbbug kbnofix KB275087
 

Article Translations

 

Related Support Centers