ACC2000: Renaming Database Does Not Cause Code to Become Decompiled (208224)



The information in this article applies to:

  • Microsoft Access 2000

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).

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.

RESOLUTION

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

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.

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbprb kbusage KB208224