Hi Guys,

I have an address field which I split by the vbcrlf character. Now when I split the address and assign it to an array that array could have a different number of elements each time.

I am adding the split data to a listview which has 4 columns.

currently I do this:
Code:
            li.SubItems(1) = IIf(AddText(0) = "", "", AddText(0))
            li.SubItems(2) = IIf(AddText(1) = "", "", AddText(1))
            li.SubItems(3) = IIf(AddText(2) = "", "", AddText(2))
            li.SubItems(4) = IIf(IsNull(rs!code), "", rs!code)
that works well if the address is captured correctly, but say I got an address with just "test". Array elements 1,2 and 3 will be "subscript out of range"

Can anyone proved me with a solution or perhaps a better way of doing this.