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

Item cannot be found in the collection corresponding to the requested name or ordinal

$
0
0
when the user clicks the student's year level the subjects will appear in a listview however I'm having an error here's my code
Code:

Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM [tblsubject] WHERE [yearlevel] = '", cbstudlvl.Text & "'", con, adOpenStatic, adLockOptimistic
    ListView1.ListItems.Clear
        If rs.RecordCount <> 0 Then
            For a = 1 To rs.RecordCount
                ListView1.ListItems.Add , , rs![subcode]
                ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs![subname]
                ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs![yearlevel]
                rs.MoveNext
            Next a
        End If


Viewing all articles
Browse latest Browse all 21980

Trending Articles



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