Full Version: Save as PDF
UtterAccess Forums > Microsoft® Access > Access Forms
doran_doran
Hi,
The following code saves a report in PDF file. It''s all working. Thanks for UtterAccess Forum.
I want to save the file "report name - systems date" but it's doing. it creates a file name "filename" with no extension.
Private Sub SavetoPDF_Click()
Dim ReportName As String
Dim ReportDesc As String
Dim FileName As String
Dim DateToday As Date

DateToday = Date
ReportName = rpt402gdept
'ReportDesc = Me.cboReports.Column(2)
FileName = ReportName & " - " & Format(DateToday, "mm-dd-yyyy")

Call SaveReportAsPDF("rpt402gdept", "c:\pdf\FileName")
' DoCmd.OutputTo acReport, ReportName, "SnapshotFormat(*.snp)", strFolderName & "\" & FileName & ".snp", True, ""
End Sub
argeedblu
It's Friday so I may be missing something here. Your code as the statement
CODE
Call SaveReportAsPDF("rpt402gdept", "c:\pdf\FileName")

What library has this function? I can't find any reference to it in my Access help files.
Glenn
doran_doran
Thanks Glenn and everyone. The following code is working for my needs.
It saves the pdf file and gives this name "rpt402gdept - 10-08-2004.pdf"
10-08-2004 is coming from system (the date)
Thanks
= = = = Working Version of the Code = = = =
Private Sub SaveToPDF_Click()
Dim ReportName As String
Dim ReportDesc As String
Dim FileName As String
Dim DateToday As Date

DateToday = Date
ReportName = "rpt402gdept"
'ReportDesc = Me.cboReports.Column(2)
FileName = ReportName & " - " & Format(DateToday, "mm-dd-yyyy") & ".pdf"

Call SaveReportAsPDF("rpt402gdept", FileName)
End Sub
argeedblu
I could tell from your first posting that the code was working for your need (because you said so). However, the code calls the function SaveReportAsPDF but it does not define the function. So, my question again, is, where is the function SaveReportAsPDF defined. The only mention of it that I can find in UA is in this very thread. In order to use it, the function must be defined somewhere. What VBA references do your have set in your project?
Glenn
doran_doran
I am attaching a Sample Copy.
There is Module "BasPDFSaver" and there are few functions on the form by it self. Check it out...
Oalso want to hide the pdf button on the form if the end user does not pdfwriter installed on her/his machine.
Please my other post below.
http://www.utteraccess.com/forums/showflat...4284&Forum=,All_Forums,&Words=&Searchpage=0&Limit=25&Main=553809&Search=true&where=&Name=25089&daterange=&newerval=&newertype=&olderval=&oldertype=#Post554284&bodyprev=
argeedblu
Thanks,
You have defined the SaveReportasPDF function in the form code. The code you originally posted needs that function in order to work for anyone else. Incidentally, the db you posted can't be used to test or demo the functions because the queries rely on linked tables so the report can't 'run.'
Glenn
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.