Copying an Access Report using VB codes to another Database

bnw

Registered User.
Local time
Yesterday, 18:21
Joined
Sep 19, 2006
Messages
26
I need some expert who can tell me how can I copy a report from one database to another database using a VB code and/or SQL statement using Access 2002

Thank you in advance for your help.
 
copy object

Use the following code

DoCmd.CopyObject "destinationdatabase", "objectnewname", sourceobjecttype, "sourceobjectname"

example
DoCmd.CopyObject "C:\mydatabase.mdb", "copyofreport1", acReport, "report1"
 
What should rest of the code be from the beginning to end

Hello

Thanks for responding to my forum. :(
I need to know what are the sample DIM variables I need to declare before the docmd?

QUOTE=pl456;697922]Use the following code

DoCmd.CopyObject "destinationdatabase", "objectnewname", sourceobjecttype, "sourceobjectname"

example
DoCmd.CopyObject "C:\mydatabase.mdb", "copyofreport1", acReport, "report1"[/QUOTE]
 
You don't need to decalre anything. The Docmd.copyobject line will run on its own. You just need to change the example to your own names.
Chris
 
Hi Stopher

Ok, Do I need to create a command button for the On Click procedure and then type the code into the module?
 
Hi Stopher

I did use the Docmd code above by creating a command button on a blank form using the event procedure to copy a report that is in the same database. However, my goal is to copy the report into a different database.
 

Users who are viewing this thread

Back
Top Bottom