Solved

Export Access 2010 report as XPS file type via Code

Posted on 2015-02-20
2
164 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

744 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

11 Experts available now in Live!

Get 1:1 Help Now