Text Box Populate

P

PieterC

I would like to have two fields in a form. One field is a
combo box with data from a table. And the other is a text
box. The text box is to be populated based on what is
entered in the combo box.

ex

Combo Box - Value {2315}
After this is selected the text box, which is blank will
be populated
Text Box - Value {Clerical Worker}

How do I get the Text box populated automatically.

Thanks
 
S

S.L.

Hi,

First, You write a function that get combobox'value as argument and returns
populate value like

Sub Function Populate(ComboValue as Variant) as Long

Second, In textbox's Control Source property, specify =Populate(MyCombo)
(Equal sign is need).

Whenever you select item in combo box, your textbox automatically populate
value.

HTH
 
F

Fredg

Pieter,
I guess the how depends upon why.

You can set the control source of the text box to:
=ComboName

You can code the AfterUpdate event of the Combo box:
[TextBoxName] = Me!ComboName

In both instances, I'm assuming the Combo Box bound column is the column
displayed.
If the Bound column is hidden, then use
ComboBoxName.Column(x)
where x is the column wanted.
If the column wanted is the second column, then x = 1.

Why would you want to do this, when the combo box already is showing the
data?
 

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