Microsoft KB Archive/223199

= ACC2000: Module Disappears After Running Code =

Article ID: 223199

Article Last Modified on 6/28/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q223199





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
Running code in a module may cause the module to disappear.



CAUSE
When you are running code in a new, unsaved module and the code includes the programmatic creation and saving of another new module, the module that contains the running code disappears.



RESOLUTION
Because existing (saved) modules are not affected when new modules are created programmatically, ensure that the active module is compiled and saved before you run it.

Unfortunately, there is no way to recover a module that has disappeared because of this issue.



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



Steps to Reproduce Behavior
 Open the sample database Northwind.mdb. Create a new module. Note the module's name, Module1, in the Project Explorer window. On the Tools menu, click References. Click to select (check) the Microsoft Visual Basic for Applications Extensibility <Version> check box.</li>  Type the following line in the Declarations section: Option Explicit </li>  Type the following procedure: Sub CreateMod Dim myModule as Object Set myModule = Application.VBE.VBProjects("Northwind"). _     VBComponents.Add(vbext_ct_StdModule)

' The following line causes the module to disappear DoCmd.Save acModule, myModule.Name End Sub </li> With the pointer inside the function, click Run Sub/Userform on the Run menu.

Note that a new module has been created, Module2, and the initial module, Module1, no longer appears in the Project Explorer window.</li></ol>

Additional query words: pra deleted delete removed remove

Keywords: kbbug kbpending KB223199

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.