Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21845

[RESOLVED] To show list in Listview when other Listview selected

$
0
0
gud day,

I have listview1 with "Category" and each category has list of Technicians.
And when Category is selected in listview1, the list of Technician should display in listview2.

I was trying with this code.

Code:

Private Sub ListView2_ItemClick(ByVal Item As MSComctlLib.ListItem)

With Me
Label3.Caption = Me.ListView2.SelectedItem.Text
End With

On Error GoTo err:
    If rs.State = adStateOpen Then rs.Close
    Me.ListView1.ListItems.Clear
    rs.Open "Select * from tblEmp where Category" = Me.Label3.Caption, cn, adOpenKeyset, adLockPessimistic
    Do While rs.EOF = False
    Me.ListView1.ListItems.Add , , rs.Fields("NAME").Value
    rs.MoveNext
    Loop
   
    Exit Sub
err:
    MsgBox err.Description, vbCritical, "Error"
    Set rs = Nothing

End Sub

And I get error like attached.

any help please.
regards
vb kid
Attached Images
 

Viewing all articles
Browse latest Browse all 21845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>