Export Report to PDF & File Name (1 Viewer)

jonnywakey

Registered User.
Local time
Today, 10:36
Joined
Feb 2, 2009
Messages
33
Hi All.

I'm trying to put together a few lines of VBA code to export a report called "Rework Label Report" to a specific network location in PDF Format, I have already achieved this level of code and it works fine (code below); however each report has a unique number in the database [ID] which I would like included in the title of the PDF when exported and saved???

Any ideas / help would be much appreciated!

Code so far:-

Private Sub Command20_Click()
Dim stReport As String
Dim stSubject As String
Dim FileNamePDF As String
strSubject = "Rework Label Report" & Me!Combo3 '
strReport = "Rework Label Report"
strWhere = "[ID]=" & Me!Combo3

DoCmd.OpenReport strReport, acViewPreview, , strWhere
DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, "R:\CUKDOCS\Internal Reject Database\Report PDF\Rework Label Report.pdf"


Me!Combo3 is a combobox on form which selects the number of the report to be viewed ,the user then sees a preview of their chosen report and then clicks Cmd20 to export to PDF, currently the file is named Rework Label Report when saved.

Thanks

Jonny:)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:36
Joined
May 7, 2009
Messages
19,169
DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, "R:\CUKDOCS\Internal Reject Database\Report PDF\" & strSubject & ".pdf"
 

jonnywakey

Registered User.
Local time
Today, 10:36
Joined
Feb 2, 2009
Messages
33
Thanks arnelgp, you've solved my problem, much appreciated.

Jonny
 

Users who are viewing this thread

Top Bottom