Access Report to PDF to Save

Sreemike

Registered User.
Local time
Today, 00:33
Joined
Jan 20, 2012
Messages
54
I want to click a button and various reports are automatically saved to my desktop folder in pdf format.
I can get to output pdf but have to manually save into the folder for each report.
The code I had written isn't saving at all.... where am I going wrong with this code:


Private Sub Command127_Click()

On Error Resume Next

DoCmd.OutputTo acOutputReport, "rptPrnAuto", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

DoCmd.OutputTo acOutputReport, "rptPrnCyto", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

DoCmd.OutputTo acOutputReport, "rptPrnLAD", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

DoCmd.OutputTo acOutputReport, "rptPrnMolecular", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

DoCmd.OutputTo acOutputReport, "rptPrnnonRICNK69", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

DoCmd.OutputTo acOutputReport, "rptPrnRICNK69", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

DoCmd.OutputTo acOutputReport, "rptPrnSubsets", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

DoCmd.OutputTo acOutputReport, "rptPrnTH1TH2", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf"

Err.Clear

End Sub
 
there are many report but saving on 1 pdf file.
 
So designate each report with a unique name?
 
Yes. Unique name solves the problem. The new code is as follows:

Private Sub Command127_Click()

On Error Resume Next
DoCmd.OutputTo acOutputReport, "rptPrnAuto", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\AutoAb.PDF"
DoCmd.OutputTo acOutputReport, "rptPrnCyto", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\CustomersCytotoxicity.PDF"
DoCmd.OutputTo acOutputReport, "rptPrnLAD", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\LAD.PDF "
DoCmd.OutputTo acOutputReport, "rptPrnMolecular", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\Molecular.PDF "
DoCmd.OutputTo acOutputReport, "rptPrnnonRICNK69", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\NK69.PDF "
DoCmd.OutputTo acOutputReport, "rptPrnRICNK69", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\RICNK69.PDF "
DoCmd.OutputTo acOutputReport, "rptPrnSubsets", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\Subsets.PDF "
DoCmd.OutputTo acOutputReport, "rptPrnTH1TH2", acFormatPDF, "C:\Users\sreem\Desktop\RIC_RptToPdf\TH1TH2.PDF "

Err.Clear
End Sub


Is there any way I can automatically assign the surname field on the report to the pdf output name; eg: AutoAb_SMITH for the first one?
 
Try:
Code:
"C:\Users\...\AutoAb_" & [Surname] & ".pdf"
 
Try:
Code:
"C:\Users\...\AutoAb_" & [Surname] & ".pdf"
The surname will be patient's surname. Each report is based on an individual query. Is there anyway saving the pdf of report with the surname of the patient automatically filled in.... eg: If patient's surname is Trump, then save this report pdf as Trump****.pdf?
 

Users who are viewing this thread

Back
Top Bottom