Populate a text box based on a combo box

S

Scott

I have cascading combo boxes, first combobox dtermines what value is
displayed in the second. What I am trying to do is populate a text box based
on what is in the second combobox. Ex. 1st Combo- "Grocery Category" The
Categories are listed in one table (GroceryT) Ex. Beverage, Poultry etc.. 2nd
combo- "Grocery Type" These values are in seperate tables ex PoultryT,
BeverageT which lists all of the types of the particular type. What I would
like my text box to do is populate based on the second combo box and store it
within one of the tables. I have tried an unbound text box with the value
based on the the second column in the second combo box, it works but the
value is not stored anywhere. When you change records and go back it is not
displayed.

I hope this makes sense. Can Anyone help.
 
A

Arvin Meyer [MVP]

If you are storing the Primary Key of the second combo (which is what you
should be doing) you do not need to store any of the values. That said, use
the AfterUpdate event of the second combo to read the column into a bound
textbox like:

Private Sub Combo2_AfterUpdate()
Me.txtWhatever = Me.Combo2.Column(1)
End Sub
 

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

Top