Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Renaming Database Does Not Cause Code to Become Decompiled


View products that this article applies to.

This article was previously published under Q208224
Moderate: Requires basic macro, coding, and interoperability skills.

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

↑ Back to the top


Symptoms

The Microsoft Access 2000 Help file contains the following incorrect statement about what happens to Visual Basic for Applications code when you rename a database:
When you rename a database, compiled code in the database will be decompiled. To recompile code and save all modules in a compiled state, open the database, open a module in Design view, and click Compile And Save All Modules on the Debug menu.

↑ Back to the top


Resolution

Microsoft Access 2000 does not exhibit this behavior. When you rename a database in Microsoft Access 2000, the code is not decompiled.

↑ Back to the top


More information

Each Microsoft Access database contains a Visual Basic project, which is the set of all code modules in the database. In Microsoft Access 7.0, the database name and the project name are always the same. Therefore in Microsoft Access 7.0, renaming a database renames the project, and renaming the project causes your code to decompile.

In Microsoft Access 97 and 2000, when you create a new database, the project name defaults to the database name. However, in these versions of Access, the project name is independent of the database name. If you rename a database file, its project name does not change; therefore, your code is not decompiled.

To set the project name for your database in Access 2000, follow these steps:
1.Start Access 2000 and open any database.
2.Press CTRL+G to open the Immediate window and any existing module.
3.On the Tools menu, click MyDatabase Properties.
4.Type the name of your project in the Project Name box, and then click OK.
To compile your code under the new project name, follow these steps:
1.Open any module in Design view.
2.On the Debug menu, click Compile MyDatabase.

Steps to Reproduce Behavior

1.On the Help menu, click Microsoft Access Help.
2.In the What would you like to do? dialog box, type convert access basic code to visual basic, and then click Search.
3.In the Help window, scroll down to the "Renaming a Database" section. Notice the same paragraph that was quoted in the "Symptoms" section.

↑ Back to the top


Keywords: KB208224, kbusage, kbprb

↑ Back to the top

Article Info
Article ID : 208224
Revision : 2
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 280