I need a help.how can i SEARCH a record in a database using listbox and display the results?? For an example: if i select a destination on the listbox and it will look for the records on database and display it.
im using ms access and adodb connection.Below is my coding for my program

Dim con As New adodb.Connection                  
Dim r As New adodb.Recordset

con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\db4.accdb;"

r.Open "SELECT Destination FROM tblFare , con, adOpenDynamic, adLockOptimistic, adCmdTex"

If r.BOF = True Or r.EOF = True Then
   Label7.Visible = True
    Exit Sub
    Text8.Text = r!Destination
    Text9.Text = r!Fare
    End If

Isuggest you to use the Adodc controls instead of writing adodc coding. Also, you may use a Listview to show the retrieved data instead of a Listbox, which is more effective. Thereby you will not have any row alignment issues. To get the data from desired table you may use the Filtering codes.

This question has already been answered. Start a new discussion instead.