Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

PrintTo PDF, user cancels error

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
Ernest Grogg
Asked:
Ernest Grogg
1 Solution
 
Rey Obrero (Capricorn1)Commented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now