You can use the RenameObject macro action to rename a specified database object in Access desktop databases.
Note: Beginning in Access 2010, the Rename macro action was changed to RenameObject.
Note: This macro action won't be allowed if the database is not trusted.
Setting
The RenameObject macro 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 macro design 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, Stored Procedure, or Function. To rename the object selected in the Navigation Pane, 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 RenameObject action in a library database, Access first looks for the object with this name in the library database, and then in the current database. |
Remarks
The new name of the database object must follow the standard naming conventions for Access objects.
You can't rename an open object.
If you leave the Object Type and Old Name arguments blank, Access renames the object selected in the Navigation Pane. To select an object in the Navigation Pane, you can use the SelectObject macro action with the In Navigation Pane argument set to Yes.
You can also rename an object by right-clicking it in the Navigation Pane, clicking Rename, and entering a new name. With the RenameObject action, you don't have to select the object first in the Navigation Pane, and you don't have to stop the macro to enter the new name.
This action differs from the CopyObject macro action, which creates a copy of the object under a new name.
To run the RenameObject action in a Visual Basic for Applications (VBA) module, use the Rename method of the DoCmd object.
No comments:
Post a Comment