DoCmd.Rename method (Access)
The Rename method carries out the Rename action in Visual Basic.
Syntax
expression.Rename (NewName, ObjectType, OldName)
expression A variable that represents a DoCmd object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
NewName | Required | Variant | A string expression that's the new name for the object that you want to rename. The name must follow the object-naming rules for Microsoft Access objects. |
ObjectType | Optional | AcObjectType | An AcObjectType constant that specifies the type of object to rename. The default value is acDefault. |
OldName | Optional | Variant | A string expression that's the valid name of an object of the type specified by the ObjectType argument. If you execute Visual Basic code containing the Rename method in a library database, Access looks for the object with this name first in the library database, and then in the current database. |
Remarks
Use the Rename method to rename a specified database object.
If you leave the ObjectType and OldName arguments blank (the default constant, acDefault, is assumed for ObjectType), Access renames the object selected in the Database window. To select an object in the Database window, you can use the SelectObject method with the InDatabaseWindow argument set to Yes (True).
Example
The following example renames the Employees table.
DoCmd.Rename "Old Employees Table", acTable, "Employees"
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기