PDA

Click to See Complete Forum and Search --> : Printing Multiple Reports


Encoder
May 18th, 2009, 09:26 PM
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

wes4dbt
May 19th, 2009, 11:24 AM
You could create a one page report by using only label controls. But the datasource must only have one record.
This works,

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.

rogermusad
May 19th, 2009, 04:15 PM
Check for Batch Printing or Batch scheduling kind of APIs in the tool you are using. I have seen then in some tools..