Originally Posted by
Sean_OL
I have built a form that allows a user to search a data sheet, and display the results in a listbox, however I am having a bit of trouble getting the results to display in the best way.
The results from the search a poplulated into an array which I then can populate the listbox with by using:
lstResults.list = arrSites.
However the array has empty rows at the end, so the list box is populated with empty data after the first few records.
I have tried to use the .Additem method instead, but I do not know how to use this for a multi column listbox (Site Name, Site ID, State etc.)
Should I just be happy I have the results showing, and ignore the empty rows, or is there some other way to populate the listing?
Sean
An example
Dim ary, i, j
ary = [{"Bob","M", 123;"Lynne","F",898;"Amy","F",543}]
With ListBox1
For i = 1 To 3
.AddItem ary(i, 1)
For j = 2 To 3
.List(.ListCount - 1, j - 1) = ary(i, j)
Next j
Next i
End With