Solved

PrintTo PDF, user cancels error

Posted on 2014-12-17
1
136 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
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

809 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