Hi
I have a method below, that populates a listview. As it is now it ommits last two columns from array of data it's getting, I need to change that so that it can return everything. but I get incorrect with every try, may my logic is wrong. Is one can change the code for me I'll paste it and see if I'll get correct out put.
CODE:
I have a method below, that populates a listview. As it is now it ommits last two columns from array of data it's getting, I need to change that so that it can return everything. but I get incorrect with every try, may my logic is wrong. Is one can change the code for me I'll paste it and see if I'll get correct out put.
CODE:
Code:
Private Sub PopulateListView1()
Dim i As Integer 'used to loop thru rsHP fields
Dim lvwsubItem As ListSubItem
Set lvwItem = frmListView.ListView1.ListItems.Add(, , _
vRSFrom.Fields(1).Value)
lvwItem.ForeColor = ListViewColor
For i = 2 To vRSFrom.Fields.Count - 3 'This is done to bypass the 2 fields
'at the end which is not to be displayed
If Not IsNull(vRSFrom.Fields(i).Value) Then
If i = 3 Then
Select Case vRSFrom!AccCode
Case "100", "110", "111", "120", "149", _
"150", "190", "160", "180", "230"
Set lvwsubItem = lvwItem.ListSubItems.Add(Text:="") 'skip 1 listview column
Set lvwsubItem = lvwItem.ListSubItems.Add(Text:=Format(vRSFrom.Fields(i).Value, "###,###,##0.00"))
lvwsubItem.ForeColor = ListViewColor
If vRSFrom!AccCode = "230" Then
' Don't add to totals
Else
dCrTotal = dCrTotal + vRSFrom.Fields(i).Value
End If
Case Else
Set lvwsubItem = lvwItem.ListSubItems.Add(Text:=Format(vRSFrom.Fields(i).Value, "###,###,##0.00"))
lvwsubItem.ForeColor = ListViewColor
Set lvwsubItem = lvwItem.ListSubItems.Add(Text:="") 'skip 1 listview column
If vRSFrom!AccCode = "530" Then
' Don't amounts add to totals
Else
dDrTotal = Format(dDrTotal + vRSFrom.Fields(i).Value, "###,###,##0.00")
End If
End Select
Else
Set lvwsubItem = lvwItem.ListSubItems.Add(Text:=vRSFrom.Fields(i).Value)
lvwsubItem.ForeColor = ListViewColor
End If
Else
Set lvwsubItem = lvwItem.ListSubItems.Add(Text:="") 'skip 1 listview column
End If
Next i
Set lvwItem = Nothing 'release object stored in memory
Set lvwsubItem = Nothing 'release object stored in memory
End Sub