Copy a database object to a different Access database or to the same database or Access project (.adp) under a new name.

      DoCmd.CopyObject(DestinationDatabase, NewName,
                     SourceObjectType, SourceObjectName)

                    A string expression that's the valid path and
                    file name for the destination database
                    To select the current database, leave this argument blank.

                    In an Access project/library (.adp) leave this argument blank.

   NewName          The new name for the object to copy.
                    default=same name as source.

  SourceObjectType  An AcObjectType constant that represents the type
                    of object to copy.

  SourceObjectName  The name of an object to copy.

Either destinationdatabase or newname (or both) must be specified.

If sourceobjecttype and sourceobjectname arguments are left blank, Access will copy the object selected in the Database window.

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


DoCmd.CopyObject, "T_Patients Copy", acTable, "T_Patients"

“We could have saved the Earth but we were too damned cheap” ~ Kurt Vonnegut, Jr.


DeleteObject - Delete an object

© Copyright 1999-2015
Some rights reserved