Rename Action

Rename Action

See Also        

You can use the Rename action to rename a specified database object.

Setting

The Rename action has the following arguments.

Action argument Description
New Name A new name for the database object. Enter the object name in the New Name box in the Action Arguments section of the Macro window. This is a required argument.
Object Type The type of object you want to rename. Click Table, Query, Form, Report, Macro, Module, Data Access Page, Server View, Diagram, or Stored Procedure. To rename the object selected in the Database window, leave this argument blank.
Old Name The name of the object to be renamed. The Old Name box shows all objects in the database of the type selected by the Object Type argument. If you leave the Object Type argument blank, leave this argument blank also.

Note   If you run a macro containing the Rename action in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.


Remarks

The new name of the database object must follow the standard naming conventions for Microsoft Access objects.

You can't rename an open object.

If you leave the Object Type and Old Name arguments blank, Microsoft Access renames the object selected in the Database window. To select an object in the Database window, you can use the SelectObject action with the In Database Window argument set to Yes.

You can also rename an object by clicking it in the Database window, clicking it again so you can edit its name, and entering a new name. With the Rename action, you don't have to select the object first in the Database window, and you don't have to stop the macro to enter the new name.

This action differs from the CopyObject action, which creates a copy of the object under a new name.

To run the Rename action in Visual Basic, use the Rename method of the DoCmd object.