title: How to search access database and display in Listview VB6?
body: <p>I'm creating a program where the user can search items in an access database and results are displayed in a listview. </p>
  
  <p>When I click search all items are displayed but when I enter an item in the textbox then search nothing is displayed. </p>
  
  <p>This is my code</p>
  
  <pre><code>Private Sub cmdProdSearch_Click()
  Dim conn As ADODB.Connection
  Dim rs As ADODB.Recordset
  Dim list_item As ListItem
  Dim itm As ListItem
  
  db_file = db_file &amp; "ProductsDatabase.mdb"
  Set conn = New ADODB.Connection
  conn.ConnectionString = _
  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\VB and     Database\ProductsDatabase.mdb;Persist Security Info=False" &amp; _
  "Data Source=" &amp; db_file &amp; ";" &amp; _
  "Persist Security Info=False"
  conn.Open
  Set rs = conn.Execute("Select * from Export")
  
  ListView1.ListItems.Clear
  
  If InStr(1, rs!Product, txtProduct.Text, vbTextCompare) Then
  With ListView1
  .View = lvwReport
  .FullRowSelect = True
  Do While Not rs.EOF
  Set itm = .FindItem(txtProduct.Text, lvwText, , lvwPartial)
  Set list_item = .ListItems.Add(, , rs!Product)
  list_item.SubItems(1) = rs!barcode &amp; ""
  list_item.SubItems(2) = rs!quantity &amp; ""
  list_item.SubItems(3) = rs!Department
  rs.MoveNext
  Loop
  End With
  End If
  End Sub
  </code></pre>
  
  <p>Any ideas what is wrong?
  I dont get an errors just nothing displays.
  Thanks</p>