Printing Multiple Reports
Is it possible to print multiple reports through looping and recordset movement? I want to print each records details in single paper only so have the following code (below) but I always get an automation error:
With rptPropertyCard
Set .DataSource = adoRst
Do Until adoRst.EOF
.Sections("Section1").Controls.Item("txtDate").DataField = "date_acqd"
.Sections("Section1").Controls.Item("txtPAR").DataField = "item_no"
.Sections("Section1").Controls.Item("txtAmount").DataField = "total_value"
.Sections("Section1").Controls.Item("txtQty").DataField = "item_qty"
.Sections("Section1").Controls.Item("lblUser").Caption = frmPAR.txtByEmpCode.Text
.Sections("Section5").Controls.Item("lblSupplier").Caption = adoRst.Fields("supplier").Value
.Sections("Section5").Controls.Item("lblRIV").Caption = adoRst.Fields("riv_no").Value
.Sections("Section5").Controls.Item("lblPO").Caption = adoRst.Fields("po_no").Value
.Sections("Section5").Controls.Item("lblFund").Caption = adoRst.Fields("fund").Value
.Show vbModal
adoRst.MoveNext
Loop
End With
Re: Printing Multiple Reports
You could create a one page report by using only label controls. But the datasource must only have one record.
This works,
Code:
Dim rs As New ADODB.Recordset, rs2 As New ADODB.Recordset
'
rs.Open "select crop from crops where crop='CORN'", conCnn
rs2.Open "select crop from crops", conCnn
Do While Not rs2.EOF
With DataReport2
Set .DataSource = rs
.Sections("Section1").Controls("Label1").Caption = rs2!crop
.Show vbModal
End With
rs2.MoveNext
Loop
It seems that creating grouping on the report with a page break after each group would be a better solution.
Re: Printing Multiple Reports
Check for Batch Printing or Batch scheduling kind of APIs in the tool you are using. I have seen then in some tools..