Hi there
I am trying to learn Access, therefore, any help will be grateful
I find the following CODE online (Print to PDF)
Which work perfectly for me, the only issue and/or modification I am looking for "Popup Window to save the file at any location", instead at fixed location
I would be appreciate if you can provide the proper replacement coding, instead of professional language lol
Option Compare Database
Option Explicit
Function PrintToPDF(SrcFile As String)
On Error GoTo PrintToPDF_Err
'Function can be called from any report with this: "PrintToPDF(Screen.ActiveForm.Name)"
'SrcFile = name of report the function was called from, as generated by Screen.ActiveForm.Name
'DestPath = Destination path for PDF file
Dim DestPath As String
'DestFile = Destination file name for PDF file
Dim DestFile As String
'ShowPdf = launch acrobat and display saved PDF file
Dim ShowPdf As Boolean
'Saves the file to the desktop of the current user
DestPath = "C:\Documents and Settings\" & Environ("USERNAME") & "\Desktop\"
'Formats the file name like this: "YYYY-MM-DD-ReportNameHere.pdf"
DestFile = Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "-" & SrcFile
ShowPdf = False
DoCmd.OutputTo acOutputReport, SrcFile, "PDFFormat(*.pdf)", DestPath & DestFile & ".pdf", ShowPdf, "", 0, acExportQualityPrint
PrintToPDF_Exit:
Exit Function
PrintToPDF_Err:
MsgBox Error$
Resume PrintToPDF_Exit
End Function
I am trying to learn Access, therefore, any help will be grateful
I find the following CODE online (Print to PDF)
Which work perfectly for me, the only issue and/or modification I am looking for "Popup Window to save the file at any location", instead at fixed location
I would be appreciate if you can provide the proper replacement coding, instead of professional language lol
Option Compare Database
Option Explicit
Function PrintToPDF(SrcFile As String)
On Error GoTo PrintToPDF_Err
'Function can be called from any report with this: "PrintToPDF(Screen.ActiveForm.Name)"
'SrcFile = name of report the function was called from, as generated by Screen.ActiveForm.Name
'DestPath = Destination path for PDF file
Dim DestPath As String
'DestFile = Destination file name for PDF file
Dim DestFile As String
'ShowPdf = launch acrobat and display saved PDF file
Dim ShowPdf As Boolean
'Saves the file to the desktop of the current user
DestPath = "C:\Documents and Settings\" & Environ("USERNAME") & "\Desktop\"
'Formats the file name like this: "YYYY-MM-DD-ReportNameHere.pdf"
DestFile = Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "-" & SrcFile
ShowPdf = False
DoCmd.OutputTo acOutputReport, SrcFile, "PDFFormat(*.pdf)", DestPath & DestFile & ".pdf", ShowPdf, "", 0, acExportQualityPrint
PrintToPDF_Exit:
Exit Function
PrintToPDF_Err:
MsgBox Error$
Resume PrintToPDF_Exit
End Function