Microsoft KB Archive/202106

= ACC2000: Changes That You Make to Referenced Projects Are Not Saved in Visual Basic Editor =

Article ID: 202106

Article Last Modified on 1/26/2005

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q202106



Advanced: Requires expert coding, interoperability, and multiuser skills.

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



SYMPTOMS
In Microsoft Visual Basic for Applications, you can reference another VBA project (MDB, MDA, or ADP) in the References dialog box. By using the Project Explorer in the Visual Basic Editor, you can also see the code in referenced projects, or you can see the project's properties by clicking Properties on the Tools menu. You can see, and you can even edit the code and properties in a referenced project. However, if you make changes, your changes are not saved. You can save changes only to the project that you have currently open in Microsoft Access.



CAUSE
Access does not save the VBA project in a referenced or a library database. Therefore, any changes that you make to the referenced project--whether at the project level or in a module--are not saved. Access never prompts you to save the changes. Access also never warns you that your changes will not saved.



RESOLUTION
To make changes, open the database. This makes the database the current project. Then, make your changes to the database.



Steps to Reproduce the Behavior
 Create a new Access database named Db1.mdb.  In the Database window, click Modules, and then click New. Paste the following code into the module: Public Function TestChanges MsgBox "Hello" End Function  On the Tools menu, click  Properties, and then click the Protection tab. Click to select the Lock project for viewing check box, and in the Password and Confirm Password boxes, type red. This password protects the Visual Basic Project in the database. On the File menu, click Save, and then save the module as Module1. Close Db1.mdb.</li> Create a second Access database named Db2.mdb. Press ALT+F11 to start the Visual Basic Editor.</li> On the Tools menu click References. To create a reference to Db1.mdb, click Browse, locate Db1.mdb, and then click OK.</li> In the Project Explorer window of the Visual Basic Editor, double-click Db1 to expand its tree. When Access asks you for the password, enter the VBE password that you assigned ( red ) in step 4.</li>  Locate the module, and view its code. Add the following line of code to the Public Procedure: MsgBox "Hello World" Note that the Save button on the toolbar is not enabled, nor is the Save command on the File menu. </li> In the Project Explorer, right-click Db1, and then click  Properties.</li> In the Properties dialog box, click the Protection tab. Change the password to blue .</li> Close Db2.mdb. Note that when you close Db2.mdb, you get no error messages that say that the changes will not be saved.</li> Re-open Db1.mdb, and then click Modules. Select Module1, and then click Design. When Access asks you for the password, type the new password that you created in step 11 ( blue ). Note that Access does not accept this password.</li> Type the original password ( red ). Note that the module opens. Note that the changes that you made to the function have not been saved.</li></ol>

This behavior occurs because Access does not save any changes that you make to a referenced project.

Additional query words: prb gone not there what happened to where are my

Keywords: kbnofix kbprb KB202106

-

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

© Microsoft Corporation. All rights reserved.