Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Reports in Single Print Job

Status
Not open for further replies.

naturalsn

Technical User
Apr 26, 2007
68
GB
Good Morning

I currently have a form that has four check boxes on it, to allow users to select which report that would like to print with the current record.

It is working perfectly but now need need to provide the users with an option to use the the same checkboxes to choose which reports they would like to print to pdf. As One PDF copy. and the save under clients folder

I have been doing allot of scratching around on the net, and not to sure if this is possible, and hoping that maybe if i can send multiple reports to a single print job and define the print job as my pdf printer that might work.

I was wonder if anyone has maybe made use of script to allow this.

Currently the only code i have is the selection of my reports. and then Lebans version of printing to pdf.

But not to sure how and can amend this to make it work

To select reports
Code:
Private Sub cmdPrintReports_Click()DoCmd.RequeryIf Me.DisRecipient = True 

ThenDoCmd.OpenReport "rpt1RecipientCopy", acViewNormal, , "DocId = " & Me!DocID
End If

If Me.DisReturn = True ThenDoCmd.OpenReport "rpt2ReturnCopy", acViewNormal, , "DocId = " & Me!DocID 
End If

If Me.DisFile = True ThenDoCmd.OpenReport "rpt3FileCopy", acViewNormal, , "DocId = " & Me!DocID 
End If

If Me.QualityReview = True ThenDoCmd.OpenReport "rpt4QualityReview", acViewNormal, , "DocId = " & Me!DocID 
End If
End Sub


And an extract of Lebans

Code:
Dim tmpPrinter As PrinterSet 
tmpPrinter = Application.Printer 'Default PrinterSet Application.Printer = Application.Printers("Adobe PDF") 

'Change the application printer to adobeDoCmd.OpenReport "Rpt1RecipientCopy", acViewPreview 'Open the Report in Priview ModeFileName = "C:\"'SendKeys "^p~" & FileName & "~", False 

'Send the Open Report to a .pdf fileDoCmd.Close 

acReport, "Rpt1RecipientCopy" 'Close reportSet tmpPrinter = Application.PrinterSet Application.Printer = Application.Printers(0) ' Restore Default printers

any possibly guidance or help would be appreciated

Thank you very much in advance

Regards
SN
 
I used this code with a message box. You can change it to reference the Check box instead.

Code:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''                                                                              '
''NOTE: Be sure that the Access Report is set to Default Printer                '
''      and not Specific Printer. (File, Page Setup, Page(tab))                 '
''      If report is set to Specific Printer, the report will                   '
''      print, not save as a pdf and this code will enter an endless loop.      '
''                                                                              '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    'Print the reports to PDF files.  Use Acrobat to merge into Package
    '06-Mar-06
    'Modified 30-Apr-2008 
    Dim PrintChoice As Integer
    Dim stPath As String
    stPath = "C:\PDFfiles\"
    
    PrintChoice = MsgBox("Click Yes to Print Hard Copy only. " & vbCrLf & "Click No to create PDF files only.", vbYesNoCancel, "Print to Printer or PDF")
    If PrintChoice = vbCancel Then Exit Sub
    Call RunReportAsPDF("ACCESS_REPORT_NAME", stPath & "PDF_FILE_NAME.pdf", , PrintChoice)
    DoEvents

    Call RunReportAsPDF("ANOTHER_REPORT", stPath & "ANOTHER_PDF.pdf", , PrintChoice)
...
...

The actual code for creating the PDF came from elsewhere in Tek-Tips. Programmatically create a PDF from Access 2002
thread707-1119207

I made a modification to allow the choice of going to PDF or to Printer...

Add this to the RunReportAsPDF Function after
[tt]
Dim strDefaultPrinter As String
[/tt]

Code:
'******************************
'This part added by Steve S to allow for direct printing
'09-Mar-06
'
If prmDirectPrint = vbYes Then
    DoCmd.OpenReport prmRptName, acViewPreview, , prmWhere 'Run the report with optional Filter
    Exit Function
End If
'******************************
 
Brilliant

Thank you very much...
It worked...

thanks Again
SN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top