Pdf Report Path with date (2 Viewers)

access2010

Registered User.
Local time
Today, 14:56
Joined
Dec 26, 2009
Messages
787
Until now, we have been manually choosing the path to save each Pdf report that we make within Access 2003.
Could I place a code onto our report forms or into our reports that would save the report name with the day of the year?

The day of the year code that we use in our reports is
ht(Year(Date()),2) & "=" & DatePart("y",Date())

The path is; C:\AccountingPdfs

Using a print type button on the form I would like to pragmatically print a report and then save the Pdf reports as an example to;
C:\AccountingPdfs\Customer_QuotationR_21=151.PDF

=== the current code that have been using is below

Code:
Private Sub cmdSalesConfirmationPDF_Click()
On Error GoTo Err_cmdConf_Click
Dim stDocName As String
Dim stWhere As String
If Not CheckIfNotEmpty Then
GoTo Exit_cmdConf_Click
End If
Me.Refresh
stWhere = "[DocumentCounter]=" & Me.DocumentCounter
stDocName = "c_Customer_QuotationR_PDF"
DoCmd.OpenReport stDocName, acPreview, , stWhere
[Reports](stDocName).Caption = "Confirm_Q" & Me.DocumentCounter
DoCmd.OpenReport stDocName, acNormal, , stWhere
DoCmd.Close acReport, stDocName, acSaveNo
Exit_cmdConf_Click:
Exit Sub
Err_cmdConf_Click:
MsgBox Err.Description
Resume Exit_cmdConf_Click
End Sub

===
Your suggestions will be appreciated.
Thank you
Nicole
 
Last edited by a moderator:

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:56
Joined
Aug 30, 2003
Messages
35,342
Check out OutputTo. You could open the report in Preview mode instead of printing it, and then output it to PDF with your desired name and path.
 

access2010

Registered User.
Local time
Today, 14:56
Joined
Dec 26, 2009
Messages
787
Thank you Paul for your note.
Could you please suggest a code that we could use at, Preview, as we want to save each individual Pdf with a unique name and Day of The Year?
At the Charity which I volenteer at, we have LOTS of reports to produce.
Would the sending of one of our Data Bases help you with an answer?
Nicole
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:56
Joined
Aug 30, 2003
Messages
35,342
Something along these lines:

DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, "C:\AccountingPdfs\FixedText" & Me.DocumentCounter & ".pdf"
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:56
Joined
Aug 30, 2003
Messages
35,342
Not sure what you mean exactly by day of the year but you can also concatenate this type of thing into the string:

Format(Date(), "yyyymmdd")
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:56
Joined
Aug 30, 2003
Messages
35,342
Happy to help Nicole!
 

Users who are viewing this thread

Top Bottom