ACC2000: You Cannot Open a Form Module, and the Form's Code Does Not Run (265434)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q265434
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 are working with a form in Design view, you notice the following behavior:
  • You cannot open the module of the form by any of the standard methods, including clicking Code on the View menu, clicking the View Code button on the toolbar, or clicking the Build button on the Event tab of the property sheet.
  • You are prompted to save changes when you close the form, but the form does not close, and your changes are not saved.
  • Form objects that run code, such as command buttons, no longer work.

CAUSE

The module of the form has been removed or deleted, but the HasModule property of the form is still set to Yes.

RESOLUTION

After the module of a form is removed or deleted, the code is lost. To continue to work with this form, you must rewrite the code. To do this, set the HasModule property of the form to No, and then save the form. After you have saved the form, re-create the module of the form by either setting the HasModule property to Yes or by using one of the standard methods to open the module of the form.

To set the HasModule property

  1. Open the form in Design view.
  2. If the property sheet is not displayed, click Properties on the View menu.
  3. In the property sheet, click the Other tab.
  4. Set the HasModule property to No.
  5. Close and save the form.
  6. Reopen the form and reset the HasModule property to Yes.

STATUS

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

Modification Type:MajorLast Reviewed:6/25/2004
Keywords:kbbug kbnofix KB265434