Name and Print Report to PDF (1 Viewer)

Tophan

Registered User.
Local time
Today, 06:07
Joined
Mar 27, 2011
Messages
362
Hello,

I need help with the below code. I am trying to name and save to PDF my Invoices without having to manually name them. The problem with the code is that it is saving ALL the invoices as one document when only need the current record/invoice saved. Here is the code:

Code:
Dim FileName As String
Dim FilePath As String

FileName = Me.InvID & " - " & Me.ClientID
FilePath = "C:\Users\reva_\OneDrive\My Documents\Training\" & FileName & ".pdf"
DoCmd.OutputTo acOutputReport, "rptInvoices", acFormatPDF, FilePath
MsgBox "Invoice has been saved successfully", vbInformation, "Save confirmed"

Thanking you in advance for your help
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:07
Joined
Oct 29, 2018
Messages
21,357
Try opening the report with a filter first before saving it to pdf.
 

Tophan

Registered User.
Local time
Today, 06:07
Joined
Mar 27, 2011
Messages
362
Try opening the report with a filter first before saving it to pdf.
Hi. I tried filtering but it still saved all the records to one PDF
 

Tophan

Registered User.
Local time
Today, 06:07
Joined
Mar 27, 2011
Messages
362
Try opening the report with a filter first before saving it to pdf.
I misread your answer and tried filtering the form which is why it didn't work. When I filtered the report it worked. Thank you
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:07
Joined
Oct 29, 2018
Messages
21,357
I misread your answer and tried filtering the form which is why it didn't work. When I filtered the report it worked. Thank you
Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom