Export as PDF with specified name and current date

JYeoman

Registered User.
Local time
Today, 16:09
Joined
Aug 28, 2018
Messages
17
Hi,
I have a macro to export the report I created as a PDF, and it works perfectly fine. However, I would like to take away the 1 last option for user error and have it automatically name it "Weekly Report" and the current date.
I have tried the following in the 'Output File' section of the macro builder:

E:\Folder\AnotherFolder\Weekly Report & "_" & Format(Date(),"yyyy_mm_dd")

and this didn't work.

Any ideas?
Thanks
 
Hmm, have done in a macro but I know in VBA you need the file extension, so try...

Code:
E:\Folder\AnotherFolder\Weekly Report & "_" & Format(Date(),"yyyy_mm_dd") & ".pdf"
 
Hmm, have done in a macro but I know in VBA you need the file extension, so try...

Code:
E:\Folder\AnotherFolder\Weekly Report & "_" & Format(Date(),"yyyy_mm_dd") & ".pdf"

I converted it to VBA and used the following code:
Code:
Function SavePDF()

 DoCmd.OutputTo acOutputReport, "Weekly Report", _
 acFormatPDF, "E:\Flooring Design\Test PDF\Weekly Report" & "_" & Format(Date, "yyyy_mm_dd") & ".pdf"

End Function
However, I've since realised that my report prints a few blank pages due to margins - is there a way to tell it to print only page 1?
 
Last edited:
You have to format the report correctly in Access in order for it to output correctly. If is is on the length and not the width that causes it to run over you can set the section to Can Shrink = Yes and see if that helps but other than that you need to adjust the report.
 

Users who are viewing this thread

Back
Top Bottom