W
wigginsl
Guest
Gday all,
Have a bit of code (below) that prints 3 seperate reports all to PDF files with the click of a button, however I would like all these to be COMBINED into one PDF file through the use of the same button without having to go and do this action outside of access.....
Any help?
Private Sub Command12_Click()
Dim strDefaultPrinter As String
Dim intCounter As Integer
'save default printer name
strDefaultPrinter = Printer.DeviceName
'cycle through the printers collection till PDFCreator is found
For intCounter = 1 To Printers.Count
If Right$(Printers(intCounter).DeviceName, 10) = "PDFCreator" Then
'use this printer
Set Application.Printer = Printers(intCounter)
'do your PDF print job here
DoCmd.OpenReport "rpt_wr_report"
DoCmd.OpenReport "rpt_wr_delaytbl"
DoCmd.OpenReport "rpt_wr_Recurrent_Defects_Open"
DoCmd.Close acDefault, "rpt_wr_Recurrent_Defects_Open"
DoCmd.Close acDefault, "rpt_wr_delaytbl"
DoCmd.Close acDefault, "rpt_wr_report"
'set printer back to default printer
Set Application.Printer = Printers(strDefaultPrinter)
'all done
Exit Sub
End If
Next intCounter
'no PDF printer found
MsgBox "No PDF Printer was found!", vbExclamation, Application.Name
Have a bit of code (below) that prints 3 seperate reports all to PDF files with the click of a button, however I would like all these to be COMBINED into one PDF file through the use of the same button without having to go and do this action outside of access.....
Any help?
Private Sub Command12_Click()
Dim strDefaultPrinter As String
Dim intCounter As Integer
'save default printer name
strDefaultPrinter = Printer.DeviceName
'cycle through the printers collection till PDFCreator is found
For intCounter = 1 To Printers.Count
If Right$(Printers(intCounter).DeviceName, 10) = "PDFCreator" Then
'use this printer
Set Application.Printer = Printers(intCounter)
'do your PDF print job here
DoCmd.OpenReport "rpt_wr_report"
DoCmd.OpenReport "rpt_wr_delaytbl"
DoCmd.OpenReport "rpt_wr_Recurrent_Defects_Open"
DoCmd.Close acDefault, "rpt_wr_Recurrent_Defects_Open"
DoCmd.Close acDefault, "rpt_wr_delaytbl"
DoCmd.Close acDefault, "rpt_wr_report"
'set printer back to default printer
Set Application.Printer = Printers(strDefaultPrinter)
'all done
Exit Sub
End If
Next intCounter
'no PDF printer found
MsgBox "No PDF Printer was found!", vbExclamation, Application.Name