Carry out the Rename action in Visual Basic.

      DoCmd.Rename(NewName, ObjectType, OldName)

   NewName    The new name for the object, a string expression.

   ObjectType An AcObjectType constant for the type of object to rename.
              default = acDefault.

   OldName    A valid object name of the type specified by ObjectType, a string expression.

Use the Rename method to rename a specified database object.

If the ObjectType and OldName arguments are left blank (the default constant, acDefault, is assumed for ObjectType), Microsoft Access will rename the object currently selected in the Database window.

To select an object in the Database window, you can use the SelectObject method with the In Database Window argument set to Yes (True).


'Change the table named "Staff table" to T_Employees
DoCmd.Rename "Staff Table", acTable, "T_Employees"

“We may dig in our heels and dare life never to change, but, all the same, it changes under our feet like sand under the feet of a sea gazer as the tide runs out. Life is forever undermining us. Life is forever washing away our castles, reminding us that they were, after all, only sand and sea water” ~ Erica Jong (Parachutes and Kisses)


Close - Close a form/report/window.
DeleteObject - Delete an object.

Copyright © 1999-2024
Some rights reserved