ACC2000: Editing Form or Report Module in VBE Opens Object in Design View (210308)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q210308
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 edit the module of an unopened form or report in the Visual Basic Editor, Microsoft Access automatically opens the form or report in Design view.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

When you add an event procedure to a form or report class module, Access does not execute the event procedure unless you set the property associated with the event to "[Event Procedure]". Access cannot set the appropriate event property to "[Event Procedure]" unless the object is open in Design view. Therefore, Access opens the object in Design view automatically when you try to edit its module.

Steps to Reproduce Behavior

  1. Start Microsoft Access 2000.
  2. Open the sample database Northwind.mdb. Note that no objects are open in Design view.
  3. Press ALT+F11 to open the Visual Basic Editor.
  4. On the View menu, click Project Explorer.
  5. In the Project Explorer, expand the Microsoft Access Class Objects node under the Northwind project node.
  6. Double-click the Form_Employees class module to view the code associated with the Employees form.
  7. Edit the module in any way. For instance, add a space to one of the existing event procedures, and then remove it.
  8. Press ALT+F11 to switch to Microsoft Access.
Note that the Employees form is opened in Design view.

Modification Type:MajorLast Reviewed:6/23/2005
Keywords:kbpending kbprb KB210308