Jonny45wakey
Member
- Local time
- Today, 15:08
- Joined
- May 4, 2020
- Messages
- 48
Hi hoping someone can point out the errors in my VBA code please
I'm trying to export a report to PDF with a filename and filepath on a CMD button on click event
My current code is as follows but i keep getting a VBA Runtime error 2501 OutputTo action cancelled
Private Sub Cmd133_Click()
Dim Filename As String
Dim Filepath As String
Dim Reportname As String
Reportname = "rptInvoice"
Filename = Me.Customer & Me.InvoiceNo
Filepath = "S\Invoicing\" & Filename & ".pdf"
DoCmd.OutputTo acOutputReport, "rptInvoice", acFormatPDF, Filename & Filepath
MsgBox "Invoice has been exported to Network Location Commonshare\Invoicing", vbInformation, "Export Confirmed"
End Sub
I'm trying to export a report to PDF with a filename and filepath on a CMD button on click event
My current code is as follows but i keep getting a VBA Runtime error 2501 OutputTo action cancelled
Private Sub Cmd133_Click()
Dim Filename As String
Dim Filepath As String
Dim Reportname As String
Reportname = "rptInvoice"
Filename = Me.Customer & Me.InvoiceNo
Filepath = "S\Invoicing\" & Filename & ".pdf"
DoCmd.OutputTo acOutputReport, "rptInvoice", acFormatPDF, Filename & Filepath
MsgBox "Invoice has been exported to Network Location Commonshare\Invoicing", vbInformation, "Export Confirmed"
End Sub