Link to home
Start Free TrialLog in
Avatar of NigelRocks
NigelRocks

asked on

Problem with AddItem

Experts,

I'm attempting something that should be very simple, but is turning out not to be.  Here's the line that works:

            cboSolutions.AddItem rsCase("Solution_Description")

where "Solution_Description" is a large string.  cboSolutions. is a standard combo box.

I've decided I want to add the ID in to the index field of the combo with each string entry, so I tried:

             cboSolutions.AddItem rsCase("Solution_Description"), rsCase("Solution_ID")

where "Solution_ID" is an integer.  It didn't like this at all.  I expermented by putting a straight integer in the second field, and by putting a string literal in the first field after that.

What am I missing?
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Use ItemData property:

cboSolutions.AddItem rsCase("Solution_Description")
cboSolutions.ItemData(NewIndex) = rsCase("Solution_ID")
The second parameter specifies an existing position in the list, so must not equal or exceed the number of items.
Avatar of NigelRocks
NigelRocks

ASKER

Where do you get the "NewIndex" variable?
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial