Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PrintTo PDF, user cancels error

Posted on 2014-12-17
1
Medium Priority
?
141 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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 …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

670 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