A
Akom
I finally got my report to output as a pdf file using a
combo box on my form, with a selection of available
printers, and the code listed below; however, the default
output is to my desktop when the "Acrobat Distiller" is
selected. Is it possible to send the pdf output file to
the "strFile_pdf" path below?
Private Sub PDF1_Click()
Dim strFile_ps As String, strFile_pdf As String, Path As
String
Dim objPrinter As String
Dim DT As String
DT = DateSerial((Year(Now())), (Month(Now())), (Day(Now
())))
Path = "C:\database\security\PDF\"
strFile_pdf = Path & DT & ".pdf"
strFile_ps = "Time by Site"
' Store the default printer to reset at end
objPrinter = ActivePrinter
' Set output to selected printer
ActivePrinter = Me.CboPrinters
' Run the report
DoCmd.OpenReport strFile_ps, acViewNormal
' Restore the default printer setting
ActivePrinter = objPrinter
End Sub
Is there another way to print the report besides using
DoCmd.OpenReport with the "acViewNormal" as the code to
print it? In plain English the line would read something
like, "Print "strFile_ps," if "Acrobat Distiller" is the
selected destination, then output the file to
the "strFile_pdf" path."
The code would probably be something like this:
If objPrinter = "Acrobat Distiller" Then
Some code to send to the "strFile_pdf" path.
Else
DoCmd.OpenReport strFile_ps, acViewNormal
End If
Thanks in advance,
Al
combo box on my form, with a selection of available
printers, and the code listed below; however, the default
output is to my desktop when the "Acrobat Distiller" is
selected. Is it possible to send the pdf output file to
the "strFile_pdf" path below?
Private Sub PDF1_Click()
Dim strFile_ps As String, strFile_pdf As String, Path As
String
Dim objPrinter As String
Dim DT As String
DT = DateSerial((Year(Now())), (Month(Now())), (Day(Now
())))
Path = "C:\database\security\PDF\"
strFile_pdf = Path & DT & ".pdf"
strFile_ps = "Time by Site"
' Store the default printer to reset at end
objPrinter = ActivePrinter
' Set output to selected printer
ActivePrinter = Me.CboPrinters
' Run the report
DoCmd.OpenReport strFile_ps, acViewNormal
' Restore the default printer setting
ActivePrinter = objPrinter
End Sub
Is there another way to print the report besides using
DoCmd.OpenReport with the "acViewNormal" as the code to
print it? In plain English the line would read something
like, "Print "strFile_ps," if "Acrobat Distiller" is the
selected destination, then output the file to
the "strFile_pdf" path."
The code would probably be something like this:
If objPrinter = "Acrobat Distiller" Then
Some code to send to the "strFile_pdf" path.
Else
DoCmd.OpenReport strFile_ps, acViewNormal
End If
Thanks in advance,
Al