Consulting

Results 1 to 2 of 2

Thread: Sleeper: If state for Excel or PDF Export

  1. #1
    VBAX Newbie
    Joined
    Jun 2014
    Posts
    3
    Location

    Sleeper: If state for Excel or PDF Export

    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

  2. #2
    VBAX Expert
    Joined
    Oct 2012
    Posts
    726
    Location
    Turn on option explicit.
    (You're setting LResponse and checking Response.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •