ACC97: Renaming Database Does Not Cause Code to Decompile (160752)



The information in this article applies to:

  • Microsoft Access 97

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

SYMPTOMS

The Microsoft Access 97 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 97 does not exhibit this behavior. When you rename a database in Microsoft Access 97 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, when you create a new database, the project name defaults to the database name. However, in Microsoft Access 97, the project name is independent of the database name. If you rename a database file, its project name does not change; therefore, your code does not decompile.

To set the project name for your database in Microsoft Access 97:
  1. On the Tools menu, click Options.
  2. In the Options dialog box, click the Advanced tab.
  3. Type the name of your project in the Project Name box, and then click OK.
To compile your code under the new project name:
  1. Open any module in Design view.
  2. On the Debug menu, click "Compile and Save All Modules."

Steps to Reproduce Behavior


  1. On the Help menu, click Contents And Index.
  2. In the Help Topics dialog box, click the Index tab.
  3. Search for "converting code," and then open that topic.
  4. Click the jump entitled "Convert Access Basic Code to Visual Basic."
  5. Scroll down to the section called "Renaming a Database."

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:kbusage KB160752