Save access report as PDF and save to folder (1 Viewer)

jsbarroso

Registered User.
Local time
Today, 13:25
Joined
May 3, 2013
Messages
49
I have a few selected reports on an Access 2007 database that users can run. Is there a way for users to view the report, save as a PDF and automatically save a copy to a shared drive by modules/vba coding as an “On Click” event procedure?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:25
Joined
Feb 19, 2013
Messages
16,629
Use DoCmd.OutputIo command, using acFormatPDF
 

pr2-eugin

Super Moderator
Local time
Today, 21:25
Joined
Nov 30, 2011
Messages
8,494
Yes ! You can make use of the DoCmd.OutputTo method to save the report as a PDF.
 

jsbarroso

Registered User.
Local time
Today, 13:25
Joined
May 3, 2013
Messages
49
The report begins to Output fine to the shared folder than I get an "Run-time weeor '2501' The outputTo action was cancelled. Here is the code I am using:

sFPath = "\\mo7400svr01\cw_database\PILOT\Data_Reports\EnergyStudy\EnergyReports\Campus Reports\Campus Energy Summary" & " " & Forms!frmViewEnergyReports![Starting Date]
sFPath = sFPath & "-" & Forms!frmViewEnergyReports![Ending Date] & ".pdf"
DoCmd.OutputTo acOutputReport, "Campus Energy Summary", acFormatPDF, _
sFPath, False
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:25
Joined
Feb 19, 2013
Messages
16,629
If your outputto command is in the same form as your start and end dates, use me.[start date] this may be causing the problem.

Also you probably need to format the dates as yyyymmdd - '/' is not allowed in a file name
 

Users who are viewing this thread

Top Bottom