Exporting a Report Design (Object) from one database to another database

  • Thread starter Thread starter Sudhakara
  • Start date Start date
S

Sudhakara

Hi,
I need to Export the design of a Report ie., Report Object
from one database to another. I am using the
Application.DoCmd.TransferDatabase method, but not able to
export a report design object. Can anyone please help me
on this.

First I will select the source and target database in the
gui of VB. Now, once the source database is selected, a
list will be filled with all the reports that exists in
the database. Now, when I click on the export button
wherein I have the following code, it is not exporting the
report design.

objAccess.DoCmd.TransferDatabase acExport, "Microsoft
Access", Trim(txtTarget), acReport, Trim(cmbSource.Text), _
"Testing", True


Can anyone guide me where I am wrong

Regards
Sudhakara.T.P.
 
Hi,

Have you looked at using Application.SaveAsText and
Application.LoadFromText ?

Here's an example:

Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase "path to database1", False

objAccess.SaveAsText acReport, "name of Report",
"c:\MyReports\ReportName.txt"

Dim objAccess1 As Object
Set objAccess1 = CreateObject("Access.Application")
objAccess1.OpenCurrentDatabase "path to database2", False

objAccess1.LoadFromText acReport, "name of Report",
"c:\MyReports\ReportName.txt"

Of course you could create a more complex example whereby you could loop
through the collections AllQueries, AllForms, AllReports, AllMacros,
AllModules, AllDataAccessPages

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."



--------------------
| Content-Class: urn:content-classes:message
| From: "Sudhakara" <[email protected]>
| Sender: "Sudhakara" <[email protected]>
| Subject: Exporting a Report Design (Object) from one database to another
database
| Date: Mon, 2 Feb 2004 21:30:35 -0800
| Lines: 23
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcPqFtlGoS4nlyYWSnW/tGtLtFm6iw==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.externaldata
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.externaldata:48528
| NNTP-Posting-Host: tk2msftngxa09.phx.gbl 10.40.1.161
| X-Tomcat-NG: microsoft.public.access.externaldata
|
| Hi,
| I need to Export the design of a Report ie., Report Object
| from one database to another. I am using the
| Application.DoCmd.TransferDatabase method, but not able to
| export a report design object. Can anyone please help me
| on this.
|
| First I will select the source and target database in the
| gui of VB. Now, once the source database is selected, a
| list will be filled with all the reports that exists in
| the database. Now, when I click on the export button
| wherein I have the following code, it is not exporting the
| report design.
|
| objAccess.DoCmd.TransferDatabase acExport, "Microsoft
| Access", Trim(txtTarget), acReport, Trim(cmbSource.Text), _
| "Testing", True
|
|
| Can anyone guide me where I am wrong
|
| Regards
| Sudhakara.T.P.
|
 
Hi,

Thanks for the solution. But I have one more clarification
on this. Can I execute this sample code where there in no
access installed and I am using Access Runtime component
to show my reports. I think, instead of create object of
the access application, I should use getobject method to
create an instance of the access application. I will try
this and get back to you in case if I have any problems
with this.

Regards
Sudhakara.T.P.
-----Original Message-----
Hi,

Have you looked at using Application.SaveAsText and
Application.LoadFromText ?

Here's an example:

Dim objAccess As Object
Set objAccess = CreateObject ("Access.Application")
objAccess.OpenCurrentDatabase "path to database1", False

objAccess.SaveAsText acReport, "name of Report",
"c:\MyReports\ReportName.txt"

Dim objAccess1 As Object
Set objAccess1 = CreateObject ("Access.Application")
objAccess1.OpenCurrentDatabase "path to database2", False

objAccess1.LoadFromText acReport, "name of Report",
"c:\MyReports\ReportName.txt"

Of course you could create a more complex example whereby you could loop
through the collections AllQueries, AllForms, AllReports, AllMacros,
AllModules, AllDataAccessPages

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03 -026.asp> and/or
to visit Windows Update at
 
Back
Top