B
BBC via AccessMonster.com
I am using the following code to (try to) print a report to a PDF file (into
a specific default folder with no user intervention).
Public Sub PDFReport()
Dim strReport As String, strPDFReport As String
strReport = "Client List"
DoCmd.OpenReport strReport, acViewPreview
Reports(strReport).Visible = False
strPDFReport = CurrentProject.Path & "\ReportFiles\" & strReport
' the folder "\ReportFiles\" pre-exists in the current project folder
-
' Trial #1
DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, , False
' Trial #2
' or DoCmd.OutputTo acOutputReport, strPDFReport, acFormatPDF, , False
End Sub
Trial #1 works but required the user to select the output folder using the
standard "select folder window" (however I do not want any user interaction)
Trial #2 doesn't work, It also gives the standard "select folder window" and
then gives and error message; "... object cannot be found... " which makes
sense as the "report" is not in the output folder
How can I make this output default to a standard folder
Thanks all
a specific default folder with no user intervention).
Public Sub PDFReport()
Dim strReport As String, strPDFReport As String
strReport = "Client List"
DoCmd.OpenReport strReport, acViewPreview
Reports(strReport).Visible = False
strPDFReport = CurrentProject.Path & "\ReportFiles\" & strReport
' the folder "\ReportFiles\" pre-exists in the current project folder
-
' Trial #1
DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, , False
' Trial #2
' or DoCmd.OutputTo acOutputReport, strPDFReport, acFormatPDF, , False
End Sub
Trial #1 works but required the user to select the output folder using the
standard "select folder window" (however I do not want any user interaction)
Trial #2 doesn't work, It also gives the standard "select folder window" and
then gives and error message; "... object cannot be found... " which makes
sense as the "report" is not in the output folder
How can I make this output default to a standard folder
Thanks all