For grouping the selected reports and have them printed 1 after the other u might:
1. Create a dynamic array and the loop through it to print;
2. Create a temporary table, populate it with the selected reports, then print by looping through the records in that temp table.
The working of Dynamic Arrays are harder to explain, so for now I'll stick with the temp table approach:
Put this code in your Form_Load Event to create the temp table:
Private Sub CreateTable()
Dim db As dao.Database
Dim tbl As dao.TableDef
Dim fld As dao.Field
'Point the Database object at a reference to the current database
Set db = CurrentDb()
DoCmd.SetWarnings False
'Point a TableDef object at a new TableDef
Set tbl = db.CreateTableDef("tblPrintReports")
'Add a field to the TableDef object
Set fld = tbl.CreateField("ReportName", dbText, 25)
tbl.Fields.Append fld
DoCmd.SetWarnings True
End Sub
Every time u load the form the former temp table will be replaced by a new empty one.
Create the following sub to populate the table:
Private Sub PopulatePrintReportsTable(rptName As String)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDB()
Set rs = db.OpenRecordset("tblPrintReports", dbOpenDynaset)
rs.AddNew
!ReportName = rptName
rs.Update
rs.close
End Sub
I assume u have seperate buttons to print the diferent reports, say btnPrint1 prints report1, btnPrint2 prints report2 and so on??
Now let's take a look at the code for btnPrint1:
Private Sub btnPrint1_Click()
PopulatePrintReportsTable("report1")
End Sub
This will call Procedure PopulatePrintReportsTable and cause it to add the name "report1" to the temp table.
The other buttons are coded likewise. So every button u click will not yet print the report but just add the name of the corresponding report to the temp table. I suggest u change the caption on the buttons to something like "Select for Print".
Now u should create an extra button saying something like "Print Selected" and code it as follows:
Private Sub btnPrintSelected_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rptName As String
Set db = CurrentDB()
Set rs = db.OpenRecordset("tblPrintReports", dbOpenDynaset)
do until rs.EOF
rptName = rs!ReportName
DoCmd.OpenReport rptName, acViewNormal
rs.MoveNext
Loop
rs.close
End Sub
This code will loop thru all the report names added to the temp table and print them 1 after the other, in the order they were added.
To prevent users from accidentally selecting a report more than once u might change the print buttons codes to:
Private Sub btnPrint1_Click()
PopulatePrintReportsTable("report1")
Me.btnPrintSelected.SetFocus
Me.btnPrint1.enabled = false
End Sub
After printing u might enable them back by adding the following lines at the end of btnPrintSelected_Click
Me.btnPrint1.enabled = true
Me.btnPrint2.enabled = true
....
Have fun and HTH