Solved

Export Access 2010 report as XPS file type via Code

Posted on 2015-02-20
2
170 Views
Last Modified: 2015-02-23
I have created a button on form to export a report and save report to specified file location, however, the file does not seem to be there after running the code.   When I Manual export the file as XPS type it works great.  What am I missing?

Private Sub cmdExportReq_Click()
On Error GoTo cmdExportReq_Click_Err
    DoCmd.OutputTo acOutputReport, "rptRequirementMainQuestions", acFormatXPS, "Z:\Access Database Design\Requirement Documentation\RequirementMain.xps", True

cmdExportReq_Click_Exit:
    Exit Sub

cmdExportReq_Click_Err:
    MsgBox Error$
    Resume cmdExportReq_Click_Exit

End Sub

Open in new window


I have tried for True and false to display the results.  Neither seem to give me the correct results.
0
Comment
Question by:Karen Schaefer
2 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 40621924
Works fine for me in Access 2010.  Start with the simple things.  Change the output file location to your local hard drive.

DoCmd.OutputTo acOutputReport, "rptRequirementMainQuestions", acFormatXPS, "C:\Temp\RequirementMain.xps", True

See if that works.
OM Gang
0
 

Author Closing Comment

by:Karen Schaefer
ID: 40626645
thanks this helped
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now