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
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