using a combobox to show data in a textbox on the same form

J

Justin

I've done some searching in this group on this problem, but haven't
found what I am looking for.
Specifically, I want to select a value in a combobox and have one or
two textboxes on the same form show data relative to the combobox.

For example: the combobox selects a company name. I would like to have
the company's city and state show up in two other textboxes on the
same form.

Thanks for any help.
Justin
 
M

Matt

Justin said:
I've done some searching in this group on this problem, but haven't
found what I am looking for.
Specifically, I want to select a value in a combobox and have one or
two textboxes on the same form show data relative to the combobox.

For example: the combobox selects a company name. I would like to have
the company's city and state show up in two other textboxes on the
same form.

Thanks for any help.
Justin


If you base the combo box on a query, you can use fields from the query
as sources for your text boxes.
Can you provide more information on what you are specifically trying to
do?

Matt
 
L

Liz McCracken

Create the combo box and have it look up the value of the
company name.

In the first textbox have the property for the control
source set to the City and in the second text box set the
property control source to the State.

When you choose the company in the combo box the city and
state will automatically fill in.

Good Luck!
Liz McCracken, MOS
 
B

Bruce M. Thompson

I've done some searching in this group on this problem, but haven't
found what I am looking for.
Specifically, I want to select a value in a combobox and have one or
two textboxes on the same form show data relative to the combobox.

For example: the combobox selects a company name. I would like to have
the company's city and state show up in two other textboxes on the
same form.

Suppose your combo box (I'll call it "cboCompany") columns are as follows:

CompanyID
CompanyName
City
State

Add a textbox, name it "txtCity" and set its "Control Source" property to:

=[cboCompany].[Column](2)

Add a second textbox, name it "txtState" and set its "Control Source"
property to:

=[cboCompany].[Column](3)

Note that a combo box's column index is zero-based, so the first colum is
Column(0), the second column is Column(1), etc..

Remember to change "cboCompany" in the preceding examples to the name of the
combo box on your form.
 
J

Justin

Bruce M. Thompson said:
I've done some searching in this group on this problem, but haven't
found what I am looking for.
Specifically, I want to select a value in a combobox and have one or
two textboxes on the same form show data relative to the combobox.

For example: the combobox selects a company name. I would like to have
the company's city and state show up in two other textboxes on the
same form.

Suppose your combo box (I'll call it "cboCompany") columns are as follows:

CompanyID
CompanyName
City
State

Add a textbox, name it "txtCity" and set its "Control Source" property to:

=[cboCompany].[Column](2)

Add a second textbox, name it "txtState" and set its "Control Source"
property to:

=[cboCompany].[Column](3)

Note that a combo box's column index is zero-based, so the first colum is
Column(0), the second column is Column(1), etc..

Remember to change "cboCompany" in the preceding examples to the name of the
combo box on your form.

Thanks, Bruce. I think I was hitting all around this.

Justin
 

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