can u help me put codes in the search button pls? here's my program tnx
http://www.mediafire.com/?21sprht484fb4qp

Recommended Answers

All 2 Replies

Hi, i dont think it's wise to ask someone to download your file and try to solve your problem. I think it's better to post your code so others can analize and try to give you solution, and since i dont know exactly what is your problem, then maybe i can only give my solution from my point of view.

IMHO you could do a double click on cmdSearch and enter your search code.

Hi you can use my code:

dbase
ListView1.ListItems.clear

If Me.cboSearchBy.Text <> "" Then

Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM tblStudentProfile WHERE  " & Me.cboSearchBy.Text & "  LIKE '%" & Me.txtSearchField.Text & "%'", db, 3, 3

If Not rs.EOF Then
Do Until rs.EOF
    
        With rs
            ListView1.ListItems.Add , , rs!StudentID
            ListView1.ListItems(ListView1.ListItems.Count).SubItems(1) = rs!StudentLastName + ", " + rs!StudentFirstName + " " + rs!StudentMI
            ListView1.ListItems(ListView1.ListItems.Count).SubItems(2) = rs!Age
            ListView1.ListItems(ListView1.ListItems.Count).SubItems(3) = rs!Birthdate
            ListView1.ListItems(ListView1.ListItems.Count).SubItems(4) = rs!HomeAddress
            ListView1.ListItems(ListView1.ListItems.Count).SubItems(5) = rs!ContactNo
            ListView1.ListItems(ListView1.ListItems.Count).SubItems(6) = rs!HSYear
            ListView1.ListItems(ListView1.ListItems.Count).SubItems(7) = rs!HSSection
            
            
        End With
    rs.MoveNext
Loop
End If
rs.Close: Set rs = Nothing

lblTotal.Caption = ListView1.ListItems.Count
Else
MsgBox "Please specify something to search by", vbInformation, "Unable to search"
Me.txtSearchField.clear


End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.