Home  Fees/Services  Access Templates  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links

DoCmd Examples - Access VBA
Copy Object DoCmd

Docmd Macro VBA Example






DoCmd AddMenu
DoCmd ApplyFilter
DoCmd CancelEvent
DoCmd Close
DoCmd CopyObject
DoCmd DeleteObject
DoCmd FindRecord
DoCmd FindNext
DoCmd GotoControl
DoCmd HourGlass
DoCmd Min/Max/Restore
DoCmd OpenForm
DoCmd OpenQuery
DoCmd OpenReport
DoCmd OutputTo
DoCmd RunSQL
DoCmd SendObject
DoCmd TransferDatabase
DoCmd TransferText

Create Export Specs

 

Microsoft Office:
  MS Access 2003
  Access 2007
  Access 2010
  Access 2013


Access Docmd CopyObject Method Example

Docmd.CopyObject allows you to copy any database object.

The command syntax and command line options are explained below:

Access docmd copyobject
(line below is a continuation of line above)
Access Docmd CopyObject VBA Code



You did not know that nearly 100 cable and satellite tv installers use our software to manage their device inventory. They never lose track of an expensive device.

We have expert enterprise-level database development capabilities for cloud/web-based databases through our partnership with IT Impact.


DestinationDatabase Optional Variant. A string expression that's the valid path and file name for the DB you want to copy the object into. To select the current database, leave this argument blank.
Note: In a Microsoft Access project (.adp) you must leave the destination object argument blank.

NewName Optional Variant. A string expression that's the new name for the object you want to copy. To use the same name if you are copying into another DB, leave this argument blank.

SourceObjectType Optional AcObjectType.

AcObjectType can be one of these AcObjectType constants.
acDataAccessPage
acDefault default
acDiagram
acForm
acFunction
acMacro
acModule
acQuery
acReport
acServerView
acStoredProcedure
acTable


SourceObjectName Optional Variant. A string expression that's the valid name of an object of the type selected by the sourceobjecttype argument. If you run Visual Basic code containing the CopyObject method in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.

Note
You must include either the destinationdatabase or newname argument or both for the Access docmd copyobject method.

If you leave the sourceobjecttype and sourceobjectname arguments blank (the default constant, acDefault, is assumed for sourceobjecttype), Microsoft Access copies 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).

If you specify the sourceobjecttype and sourceobjectname arguments but leave either the newname argument or the destinationdatabase argument blank, you must include the newname or destinationdatabase argument's comma. If you leave a trailing argument blank, don't use a comma following the last argument you specify.

Example
The following example uses the Access DoCmd CopyObject method to copy the Employees table and give it a new name in the current database:

DoCmd.CopyObject, "M_Employees_Copy", acTable, "M_Employees"







Microsoft Office:
MS Access 2003
Access 2007
Access 2010
Access 2013



A Blue Claw Software Design Template:

Barcode-Device Inventory Database
 










A Blue Claw Database Design Article:

Repair Corrupted Access Table
 









Blue Claw Database Design Downloadable Tutorial:
DoCmd.OpenForm & OpenArgs VBA Example.  



Contact Information

Copyright 2000-2017 Blue Claw Database Design