Hi all,
I am still learning code and am having issues setting up the error handler for the below code. I have a button on a report that will export the report as either an Excel spreadsheet or a PDF, based on what the user selects on an option group on the report.
Code:
Private Sub Command239_Click()
Select Case Me!ExportSelection
Case 1
DoCmd.OutputTo acOutputReport, "Chain Sales", "Excel97-Excel2003Workbook(*.xls)", "", False, "", , acExportQualityPrint
Case 2
DoCmd.OutputTo acOutputReport, "Chain Sales", "PDFFormat(*.pdf)", "", False, "", , acExportQualityPrint
End Select
End Sub
The code seems to work fine - it brings up the appropriate window for saving the report in the right format. But when I click "cancel", I get an error message, likely because I don't have an error handler in place.
Any thoughts on an error check?