ASSOCIATE A PK WITH AN ITEM IN THE LISTBOX

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

How can I associate a value with the string in the listbox in VBA?

I don't want the number (PK) to be visible.

I see no ItemData property.

thanks,

Mike
 
The ListBox object has a ListIndex property that returns the index value for
the ListBox items selected, beginning with zero. If nothing is selected,
the ListIndex property returns -1.

Sel_Item = ListBox1.ListIndex

HTH

--
Michael J. Malinsky
Pittsburgh, PA

"I was gratified to be able to answer promptly,
and I did. I said I didn't know." -- Mark Twain
 
Make a two column listbox. In the second column (index 1), place your PK.
Use the columnwidths property to make the second column have a width of
zero. See Excel VBA help for details on columnwidths.
 
Thanks Tom,

That is what I needed to know.


Tom Ogilvy said:
Make a two column listbox. In the second column (index 1), place your PK.
Use the columnwidths property to make the second column have a width of
zero. See Excel VBA help for details on columnwidths.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top