Guys may tanong ako regarding sa search,,,pag kasi ako nagasearch using barcode scanner in vb6,tapos yung na search ko ay wala dun sa list,,,,,,,,,ang nangyayari ay paulit ulit na nalabas ang 'No Item found!' kung gano kadami yung letter o number sa Productcode.text ganun kadaming beses lumalabas yung "No Item found" kaya ang nangyayari madaming beses ako naga OK dun sa Msgbox na "No Item found" ,,,,,,,,nagtataka ako kasi after nung naman nung Msgbox ko,,,naglagay me ng Exit sub,,,,pero pagdating dun ganun padin,,,,nalabas padin sya,para kasi syang nagloloop.....
Ano po kaya ang solution para dito,,,,,Madaming salamat po sa inyong lahat,
Eto po ang code ko
Set Connect = New Class1
Set rx = New ADODB.Recordset
With rx
rx.Open "Select * from Inventory where Productcode like '" & Productcode.text & "'", con, 3, 3
If rx.RecordCount >= 1 Then
ListView1.ListItems.Clear
Do While Not .EOF
ListView1.ListItems.Add , , !ID, 1, 1
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(1) = "" & !Productcode
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(2) = "" & !CustomerID
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(3) = "" & !Customername
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(4) = "" & !Customerlastname
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(5) = "" & !Totalamount
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(6) = "" & !Tendered
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(7) = "" & !Balance
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(8) = "" & !Duedate
rx.MoveNext
Loop
.Close
Else
Msgbox"No Item found!"
exit sub
End If
End With
Set rx = Nothing
con.Close: Set con = Nothing
Ano po kaya ang solution para dito,,,,,Madaming salamat po sa inyong lahat,
Eto po ang code ko
Set Connect = New Class1
Set rx = New ADODB.Recordset
With rx
rx.Open "Select * from Inventory where Productcode like '" & Productcode.text & "'", con, 3, 3
If rx.RecordCount >= 1 Then
ListView1.ListItems.Clear
Do While Not .EOF
ListView1.ListItems.Add , , !ID, 1, 1
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(1) = "" & !Productcode
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(2) = "" & !CustomerID
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(3) = "" & !Customername
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(4) = "" & !Customerlastname
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(5) = "" & !Totalamount
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(6) = "" & !Tendered
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(7) = "" & !Balance
ListView1.ListItems(ListView1.ListItems.Count).Sub Items(8) = "" & !Duedate
rx.MoveNext
Loop
.Close
Else
Msgbox"No Item found!"
exit sub
End If
End With
Set rx = Nothing
con.Close: Set con = Nothing
Last edited: