Greetings all,
I have a button that has the following VBA to output the report to a PDF file:
This works perfectly. When the button is clicked, the report is automatically written to the specified path and filename and then it opens the PDF in view mode with the default PDF viewer.Code:Private Sub EXPORT_Click() Dim myPath1 As String Dim myPath2 As String Dim strReportName As String myPath2 = Me.Text23 myPath1 = "C:\Users\User1\Documents\Projects\Database\Outbound Invoices\" + myPath2 + "\" strReportName = Me.Text20 & ".pdf" DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath1 + strReportName, True End Sub
However, when I try to do the same thing on a second report, I get different results. When clicking the button, it opens the report in the PDF view and does not actually export it. I cannot see any differences in the code so I am uncertain why the second rendition is not performing like the first.
Here is the code for the second button:Am I missing something here?Code:Private Sub Command152_Click() Dim myPath_A As String Dim myPath_B As String Dim strRCVRname As String myPath_A = Me.ClientName myPath_B = "C:\Users\User1\Documents\Projects\Database\Inbound Invoices\" + myPath_B + "\" strRCVRname = Me.RCVRnumber & ".pdf" DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath_A + strRCVRnumber, True End Sub


Different results from the OutputTo function
Reply With Quote


