Hi everyone
I had a problem with the datareports
I am using MS access as database and VB 6
In the section 1 i had place text box and i want in text box the values
value 1 - value 2.
The code is given below
Please help me
Thanks
Private Sub DataReport_Initialize()
Set rs_cash_rd = New Recordset
If rs_cash_rd.State = 1 Then rs_cash_rd.Close
rs_cash_rd.Open "Select * from cash_paid where company = '" & frm_customer_reports.cmb_vendorList & "' order by invdate, invno", cn, 2, 3
Set DataReport1.DataSource = rs_cash_rd
Set DataReport1.DataSource = rs_cash_rd.DataSource
Set rs_cash_op = New Recordset
If rs_cash_op.State = 1 Then rs_cash_op.Close
With DataReport1
With .Sections("Section2").Controls
.Item("lbl_vendor").Caption = frm_customer_reports.cmb_vendorList
End With
With .Sections("Section1").Controls
Do While Not rs_cash_rd.EOF
.Item("txt_date").DataField = rs_cash_rd![invdate].Name
.Item("txt_invno").DataField = rs_cash_rd![invno].Name
If rs_cash_op.State = 1 Then rs_cash_op.Close
rs_cash_op.Open "Select invamt, amt_paid from cash_paid where company = '" & frm_customer_reports.cmb_vendorList & "' and invno = '" & rs_cash_rd![invno] & "' order by invdate", cn, 2, 3
.Item("txt_description").DataField = rs_cash_rd![mode_paid].Name
'.Item("txt_amtdue").DataField = rs_cash_rd![invamt].Name
.Item("txt_amtdue").DataField = rs_cash_op![invamt] - rs_cash_op![amt_paid]
.Item("txt_amtpaid").DataField = rs_cash_rd![amt_paid].Name
rs_cash_rd.MoveNext
rs_cash_op.MoveNext
Loop
End With
End With