JaedenRuiner
07-19-2007, 09:02 AM
How do you actually set the values of the ColumnHeads with a listbox control.
I've set:
Columncount=2
ColumnWidths=;70pt
ColumnHeads=True
Now when the listbox displays I get a border around where the Heads should be, but when I add an item it just goes to the first line after the column head. HOw do I set the value of the actual column headers.
THanks
Jaeden "Sifo Dyas" al'Raec Ruiner
WayneRyan
07-19-2007, 10:02 AM
Jaeden,
The column heads reside in Row #0 of your ListBox.
If you populate the listbox with a Query, you can define
their names.
Select Field1 As Heading1, <-- "Heading1" is the 1st column header
Field2 As MoreWords <-- "MoreWords" is the 2nd column header
From YourTable
Order By Field1
I haven't tried it, but if you are building your Listbox with the
.AddItem method, just add the desired headers first.
Wayne
JaedenRuiner
07-19-2007, 10:16 AM
Jaeden,
The column heads reside in Row #0 of your ListBox.
...
I haven't tried it, but if you are building your Listbox with the
.AddItem method, just add the desired headers first.
First off, i should offer that I'm not doing this in Access. MSO VBA is pretty universal, and a listbox is the same in all applications. When i've used a listbox with a RowSource in Access i've never had problems. But currently i'm doing this project in Word and Excel, and in the VBA help, it agrees with you that the column headers are supposedly Row#0, but they aren't.
I open the form, and in the UserForm_Initialize() method, I do this:
ListBox1.AddItem "Hello"
ListBox1.List(0,1) = "World"
And, no matter what I do, I get the bordered "header" at the top of the list box, and the first "entry" in the list below the empty head is "hello world" in separate columns.
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
WayneRyan
07-19-2007, 10:33 AM
Jaeden,
Uh oh ... I don't use Word/Excel VBA.
Possible work-around syntax:
Me.YourListBox.AddItem ("Header1;Header2")
Me.YourListBox.AddItem ("Data1;Data2")
Wayne