Solved

Export Access 2010 report as XPS file type via Code

Posted on 2015-02-20
2
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

627 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