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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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:
(column(0) is the first column)
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


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

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.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

vbnetcoderAuthor Commented:
Got it thanks!
vbnetcoderAuthor Commented:
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.

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.
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.