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

combo box display

Status
Not open for further replies.

rsims

Programmer
Sep 25, 2000
12
US
I have a form with a several combo boxes and other text boxes on it. What I'm trying to acheive is when the users selects a value from the first combo box I want the second combo box to display the specific value but also allow them to change it.
For example

They selected
40 in combo box 1

I want
Holiday Inn displayed in combo box 2, but allow them to change it to another value

Combo box 1 is from 1 table and combo box 2 is from another table.
 
Rsims,

How are the two values related? (ie. "40" and "Holiday Inn") Is the first box full of numbers from some table other than the table containing "Holiday Inn"? In other words, what are you trying to accomplish with the combo boxes?

Heather

[yinyang] [yinyang]
 
In order to get the second drop down to have values related to the second one, you can put vba code in the after update of the first box.

This is the code in it's most simplest form...

Private Sub Combo0_AfterUpdate()
Combo2.RowSource = "select hotelname from mytable where somefield = " & Combo0
End Sub

When you say change it, do you mean change the value in the underlying table or just be able to pick something else that is not on the list of things in the drop down?

If you want to allow other possiblities other than what's in the list, then you can simply change the LimitToList property of the box to NO.





lonniejohnson@prodev.us
ProDev, MS Access Applications B-) ,
May God bless you beyond your imagination.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top