VBS: refer to the id in a combo rather then the text

I added a combo box using a table with an ID field and a description field.  I want to get the value of the id field when the user clicks a button.  How?
vbnetcoderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
You can get the text from the combo, by using the column property of the combobox.
Example: cboSelectCity with 2 columns, the id and the cityname.

Get the cityname like so:
 cboSelectCity.Column(1)
(column(0) is the first column)
0
Rey Obrero (Capricorn1)Commented:
to get the values of the combo box, you will refer to the index of the columns with 0 as the first column and 1 as the second column

id=me.combobox.column(0)
description=me.combobox.column(1)

if the bound column of the combo box is 1, me.combobox.value is enough to get the id
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vbnetcoderAuthor Commented:
This is what i need:

The user clicks on a button and a message box will pop up with the id of the item the user selected.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

vbnetcoderAuthor Commented:
Got it thanks!
0
vbnetcoderAuthor Commented:
ty
0
PatHartmanCommented:
The .value property is the default property of a bound control so you would use
Me.ControlName to refer to the bound column.  That is the same as saying Me.ControlName.Value

To refer to any other column, you use the column property.
Me.ControlName.Column(?)

Just remember that the columns collection is a zero based array and so the first column is .Column(0), the second is .Column(1), etc.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.