Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.additem function not present in VBA?? 1

Status
Not open for further replies.

kingz2000

Programmer
May 28, 2002
304
DE
Hi Guys,

I have a 2 dimensional array which I want to fill into a combo box. The 1st value is the ID and the 2nd is a string.
I thought I could use cboX.additem but this function isn't present in VBA. How do I accomplish my goal?

After the combos have been filled, will I be able to obtain the 'ID' from the chosen string via cboX.listindex???

Please Help.
Thanks in advance.
 
Oh, it is present in VBA for native listboxes and combos, but starting with the 2002 (xp) versions. Earlier versions doesn't have it.

Why do you have your data in an array? Wouldn't it be easier to just use sql/a table/a query as rowsource for the combo or list?

Roy-Vidar
 
yes, thats exactly what I'm converting to now..It does make sense!:)

So, can I still use the listindex function to get the ID??

Thanks though...
 
No, the listindex will give the listindex, i e an index starting with 0 of the selected item. If you have two fields in the rowsource, id and a string, you'll make the first column bound, so to get that, you'll only use the combo name:

[tt]msgbox me!cboMyCombo[/tt]

To get the second field, use the column property

[tt]msgbox me!cboMyCombo.column(1)[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top