Listbox Multiple Colums!

  • Thread starter Thread starter Little
  • Start date Start date
L

Little

Hi! I have a listbox with two colums.
I'm trying to add data into each of the columns using...

List6.Column(0).AddItem rsName.Fields(0)
List6.Column(1).AddItem strCost

that seemed to me like the logical way of doing it, which obviously its
not ;)
Can anyone enlighten me on the correct way?

(sorry if this post seems rude, arrogant etc this is a cwk problem
thats due in in like 3 hours!)

I would highly appreciate any help!
 
Each row only requires invoking the AddItem method once. Multiple fields are
separated with a semi-colon (although it's possible, depending on your
Regional Settings, that you might need to use a comma)

List6.AddItem rsName.Fields(0) & ";" & strCost

Note that this does limit what can be in your data fields, since having a
semi-colon in the data will cause problems.
 
Ah I see many thanks =D

In my rush I ended up using a query as the row source instead

SELECT Products.ProductName, TempOrderList.ProdCost
FROM Products INNER JOIN TempOrderList ON Products.ProductID =
TempOrderList.ProductID;
 
Little said:
Hi! I have a listbox with two colums.
I'm trying to add data into each of the columns using...

List6.Column(0).AddItem rsName.Fields(0)
List6.Column(1).AddItem strCost

that seemed to me like the logical way of doing it, which obviously its
not ;)
Can anyone enlighten me on the correct way?

(sorry if this post seems rude, arrogant etc this is a cwk problem
thats due in in like 3 hours!)

I would highly appreciate any help!

I take it that you haven't looked up the AddItem method in Help. To quote:

"For multiple column lists, use semicolons to delimit the strings for each
column".

So:

List6.AddItem rsName.Fields(0) & ";" & strCost
 
Back
Top