Copying an Access Report using VB codes to another Database (1 Viewer)

bnw

Registered User.
Local time
Today, 12:40
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.
 

pl456

Registered User.
Local time
Today, 20:40
Joined
Jan 31, 2008
Messages
150
copy object

Use the following code

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

example
DoCmd.CopyObject "C:\mydatabase.mdb", "copyofreport1", acReport, "report1"
 

bnw

Registered User.
Local time
Today, 12:40
Joined
Sep 19, 2006
Messages
26
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]
 

stopher

AWF VIP
Local time
Today, 20:40
Joined
Feb 1, 2006
Messages
2,395
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
 

bnw

Registered User.
Local time
Today, 12:40
Joined
Sep 19, 2006
Messages
26
Hi Stopher

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

bnw

Registered User.
Local time
Today, 12:40
Joined
Sep 19, 2006
Messages
26
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

Top Bottom