-
I want to know how to have a listbox that I can display one field from a table, but show it in multiple columns in a listbox. Also this field could contain upwards to 400 records and I probably will need to distribute them evenly throughout the columns in the listbox. Can anyone help me?
-
-
Gosh that looks complicated just to put columns in a list box!
What I've done in the past is to use a fixed-pitch font, like Courier New, and simply add spaces between the words so that the different fields in the list are in columns. I use space(maxfieldlength+1 - len(field)) to fill in the gap.
So it looks something like this:
data1.recordset.movefirst
Do until EOF
l2=""
l1 = data1.recorset("field1")
l1 = l1 & space(maxfield1length+1 - len(l1))
If not EOF then data1.recordset.movenext
l2 = data1.recorset("field1")
l2 = l2 & space(maxfield1length+1 - len(l2))
list1.additem l1 & l2
data1.recordset.movenext
Loop
It's a little cruder I think, and you have to use a fixed-pitch font, but the code is a lot easier to follow! :)
-
I don't use that API either, I just use vbTab between the fields :)
Unfortunately, field sizes may vary, so it'll look a bit sloppy at times