Searching and filtering records from listview using VB6

Description
This program shows you on how to filter and search records from listview control. The program is designed using Visual Basic 6.0

Instructions
Steps in adding listview control
1. Go to Project Menu, the select Components
2. Select Microsoft Windows Common Controls 6.0 (SP6), then click OK button. (see figure 1)
Figure 1
Adding Microsoft Windows Common Control

3. Add Listview Control to the Form Window
Figure 2
Listview Control

Code Snippet

Sub ViewRecord(ByVal filter As StringByVal search As String)
With ListView1
    .ListItems.Clear
    .ColumnHeaders.Clear
    .ColumnHeaders.Add , , "ID", 1000
    .ColumnHeaders.Add , , "Lastname", 2500
    .ColumnHeaders.Add , , "Firstname", 2500
    .ColumnHeaders.Add , , "MI", 1500
    .ColumnHeaders.Add , , "Program", 2000
End With
Set rs = New ADODB.Recordset
With rs
    .Open "Select * from tblStudent where " & filter & " like '" & search & "%'", cn, 1, 2
    Do Until .EOF
        Set lst = ListView1.ListItems.Add(, , !id)
        lst.ListSubItems.Add , , !lastname
        lst.ListSubItems.Add , , !firstname
        lst.ListSubItems.Add , , !mi
        lst.ListSubItems.Add , , !program
        .MoveNext
    Loop
End With
End Sub

Programing Language: VB6
Database: MS Access