Problem with Populating ListView
I'm trying to populate a ListView similar to the example on page 479 of "Beginning VB6 Database Programming" by John Connell, except I'm using ADO rather than DAO. I get the following runtime error at the "itemToAdd.SubItems(n)" lines:
Runtime error â380â: Invalid property value
My code extract is below. Iâve checked the Recordset is opened correctly and the fields are valid Strings â Iâm using Biblio.mdb for testing. The ListView gets populated OK with the Title fields if I comment out the itemToAdd lines.
Any ideas?
While Not .EOF
Set itemToAdd = lvProjects.ListItems.Add(, , !Title)
If Not IsNull(![Year Published]) Then
itemToAdd.SubItems(1) = CStr(![Year Published])
End If
If Not IsNull(!Description) Then
itemToAdd.SubItems(2) = !Description
End If
.MoveNext
Wend
|