Solved

Export Access 2010 report as XPS file type via Code

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

776 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