PDA

View Full Version : Sleeper: If state for Excel or PDF Export



cuddles
06-14-2014, 10:23 AM
I am trying to create an IF statement on my export button so that it will Export to PDF or Excel. It just reverts to PDF everytime. Help




Private Sub Command36_Click()
Dim LResponse As Integer
LResponse = msgbox("Do you wish to export to Excel? If Yes, click Yes, if No, export will be a pdf file", vbYesNo, "Continue")
If Response = vbYes Then
DoCmd.OutputTo acOutputReport, "rptCAQ1", acFormatXLSX, , True
Else
DoCmd.OutputTo acOutputReport, "rptCAQ1", acFormatPDF, myreportoutput, , , , acExportQualityPrint
End If
End Sub

jonh
06-15-2014, 02:11 PM
Turn on option explicit.
(You're setting LResponse and checking Response.)