Export as PDF with specified name and current date (1 Viewer)

JYeoman

Registered User.
Local time
Today, 21:26
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
 

GinaWhipp

AWF VIP
Local time
Today, 05:26
Joined
Jun 21, 2011
Messages
5,900
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"
 

JYeoman

Registered User.
Local time
Today, 21:26
Joined
Aug 28, 2018
Messages
17
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:

GinaWhipp

AWF VIP
Local time
Today, 05:26
Joined
Jun 21, 2011
Messages
5,900
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

Top Bottom