Beacher wrote:
Hello, would anybody be able to tell me how to set a listbox's headings
in code? as well as how to define which column of a listbox data should
go into. I have a listbox that should have 2 columns, each with a
heading, and im running a loop to populate the listbox with data from
sql server.
The rowsource for a list box includes the headers if you set:
me.LstBoxName.ColumnHeads = True
The above will set the first two values in the data as the headers of
the row source. As you loop through your SQL data, you can before, or
afterward tack on headings to the string that comprises the rowsource.
Values need to be separated by semi-colons.
Make sure the listbox row sourrce type is value list, ie,
me.LstBoxName.RowSourceType = "Value List"
So once you've looped through your data and come up with strData:
Col 1 Header;Col 2 Header;Col 1 Data 1; Col 2 Data 1; Col 1 Data 2; Col
2 Data 2 etc, etc
then you go:
me.LstBoxName.rowsource = strData
--
Tim
http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me