sir i want when user click on req_no of list box1 .after that when he
should press print button those records should come on the report.
right know it is working fine .it is only showing last req_no report.
i want when user click req_no 128 from listbox1 it should show that report.similarly when user click req_no 129 from list box then it should show that record.following is the code written for print btn.
Private Sub Command4_Click()
Set rs = New ADODB.Recordset
rs.Open "SELECT MR.srno,MR.Sug_vendor, MR.Productname, MR.Qty, MR.Unit, MR.Dept_name, MR.Job_No, MR.Cost_centre, MR.Emp_name, MR.Del_date, MR.Del_point, MR.Manager, MR.Req_no From MR WHERE (MR.Req_no)=" & strReq, con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With DataReport2.Sections("Section2").Controls
.Item("Department").Caption = rs.Fields("dept_name").Value
.Item("JobNo").Caption = rs.Fields("job_no").Value
.Item("CostCentre").Caption = rs.Fields("cost_centre").Value
.Item("RequestedBy").Caption = rs.Fields("Emp_name").Value
.Item("DeliveryDate").Caption = rs.Fields("Del_date").Value
.Item("DeliveryPoint").Caption = rs.Fields("del_point").Value
.Item("Manager").Caption = rs.Fields("MANAGER").Value
.Item("RequestNo").Caption = rs.Fields("REQ_NO").Value
.Item("Sugvendor").Caption = rs.Fields("sug_vendor").Value
End With
With DataReport2.Sections("Section1").Controls
.Item("TxtSrNo").DataField = rs.Fields("srno").Name
.Item("TxtProductname").DataField = rs.Fields("productname").Name
.Item("TxtQuantity").DataField = rs.Fields("qty").Name
.Item("TxtUnit").DataField = rs.Fields("unit").Name
End With
Set DataReport2.DataSource = rs
DataReport2.Orientation = rptOrientLandscape
DataReport2.WindowState = vbMaximized
DataReport2.Refresh
DataReport2.Show vbModeless
End If
End Sub
MRPOST.zip