Solved

PrintTo PDF, user cancels error

Posted on 2014-12-17
1
139 Views
Last Modified: 2014-12-17
Hello,

I have a button on my report that will send the report to print as PDF

DoCmd.OutputTo acOutputReport, "rptMGMissingTimeOut", acFormatPDF


But if the user cancels the box that  comes up, I get the typical error to debug, ect.

What would I need to put to just cancel out the error and go back to the reportview?
Also how would I change the default report name that comes up?


Thanks in Advance!
0
Comment
Question by:Ernest Grogg
[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
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40505416
include error handling to your codes


On Error GoTo OuputPDF_Error

DoCmd.OutputTo acOutputReport, "rptMGMissingTimeOut", acFormatPDF

OuputPDF_Error:
    If Err.Number = 2501 Then
        MsgBox "Export was cancelled!"
        Err.Clear
        Exit Sub
    End If
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

635 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