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

ID: Q210308


The information in this article applies to:

Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and 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, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform 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.

Additional query words: prb


Keywords          : kbdta 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: July 6, 1999