Start New Discussion within our Software Development Community

can someone help me ? whenever i start this program its always says that
" compile error
type-declaration characters does not match declared data type.
then the rs.Fields! will go hightlight.
can someone help me ?

    Dim rs As Recordset
Private Sub Form_Load()
Dim list As ListItem
Set rs = New Recordset


    rs.Open "Select * From Barrowers", cnn, adOpenDynamic, adLockOptimistic

  Do While Not rs.EOF = True

Set list = ListView1.ListItems.Add(, , rs("Barrowers"))
list.ListItems(list.ListItems.Count).SubItems(1) = rs.Fields!("BarrowersID")
list.ListItems(list.ListItems.Count).SubItems(2) = rs.Fields!("BarrowersName")
list.ListItems(list.ListItems.Count).SubItems(3) = rs.Fields!("BarrowersType")
list.ListItems(list.ListItems.Count).SubItems(4) = rs.Fields!("BarrowersContact")
list.ListItems(list.ListItems.Count).SubItems(5) = rs.Fields!("BarrowersStatus")
end Sub

First off that code looks like VB6 not

Try setting the value of the subitems instead of the whole object.

This article has been dead for over six months. Start a new discussion instead.