Dear All,
With below vba when i print the report i get result Invoice Number 1.PDF ( voor invoice number 1)
I Would like the result is : Invoice Number R10001.PDF (see fictur)
With below vba when i print the report i get result Invoice Number 1.PDF ( voor invoice number 1)
I Would like the result is : Invoice Number R10001.PDF (see fictur)
Code:
Private Sub PRINtPDF_Click()
Dim FileName As String
Dim FilePath As String
FileName = Me.Invoice Number & " " & Me.Invoice
FilePath = "C:\Data 2023\" & FileName & ".PDF"
On Error Resume Next
Kill FilePath
On Error GoTo 0
DoCmd.OpenReport ReportName:="DataReport", View:=acViewPreview, WindowMode:=acHidden, WhereCondition:="[Imvoice]=" & Me![Invoice]
DoCmd.OutputTo acOutputReport, "DataReport", acFormatPDF, FilePath
MsgBox "Done", vbInformation, "Save Confirm"
DoCmd.Close acReport, "DataReport", acSaveNo
End Sub
Attachments
Last edited: