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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to search/select item in VBA ComboBox?

Status
Not open for further replies.

BLKahuna

Programmer
Dec 10, 2008
4
US
I am building a form in Access 2007 that has an unbound ComboBox. It's record source is a query:

SELECT EventName, EventID FROM Events ORDER BY EventName

ComboBox.Column(0) = EventName
ComboBox.Column(1) = EventID

I have the ComboBox set to only display the EventName (by making the width of Column(1) = 0). I would like to set the selected item in the dropdown by EventID. For example: I have an Event where the EventID = 12 and the EventName = "My Event". I want to be able to set the selected item in the ComboBox by using the EventID of 12. When I'm finished, I want the ComboBox.Value to be the EventName and if I drop down the list the proper item will be highlighted.

This would seem a fairly natural request for a combobox - to be able to search by an index but I'm not having much luck figuring out the solution.

Thanks in advance for any help - much appreciated.

BK
 
Hi,

You might get better results posting in an Access forum like forum705.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top