Auto Fill on form

T

Turk Ries

Could someone please give guidance on how to make a combo box fill in
multiple fields.

I have a form with a combo box and I have figured out how to make it fill in
a field on that same form. I need it to fill in multiple fields.

For example, if I select a family members name, I want it to fill in the
address field, the city field, etc.

Thank you.
 
H

Hunter57

Hi Turk,

You can use the Combo Box's Columns to do this. First your Combo Box's Row
Source Query or SQL statement has to get the information you want. Then you
can get those values like this.

In Code:
Me.MytextBoxName = MyComboBox.Column(2)

There is one thing to note: The Columns are Zero bases. The First Column
is Column(0), the second column is Column(1)

If the textboxes you are using for the data are UnBound, then you do not
have to use code, you can set the Control Source of the textbox like this:

=[MyComboBox].Column(3)

If the textboxes are Bound then you need to add code to the AfterUpdate
Event of the Combo Box.

Me.MyTextBoxName = Me.MyComboBox.Column(4)

You may also want to use the same code in the OnCurrent Event of the Form.

Best Regards,
Patrick Wood
http://gainingaccess.net
Free Tutorial series on building a Date Dialog Form you can use with Forms
and Reports, and working with Outlook from Access.
 
J

John W. Vinson

Could someone please give guidance on how to make a combo box fill in
multiple fields.

I have a form with a combo box and I have figured out how to make it fill in
a field on that same form. I need it to fill in multiple fields.

For example, if I select a family members name, I want it to fill in the
address field, the city field, etc.

Thank you.

Why?

Relational databases use the Grandmother's Pantry Principle: "A place - ONE
place! - for everything, everything in its place". The address, city, etc.
should exist in the Addresses table (or if each person can have only one
address, the People table) and NO PLACE ELSE. If you're trying to store the
data redundantly in another table, don't; instead use Queries to look it up as
needed.

To *display* the information on the form (without storing it redundantly in
the form's recordsource table) put textboxes on the form with control sources
like

=comboboxname.Column(n)

where n is the zero based index of the field in the combo's rowsource query;
that is if the combo is named cboCustomer and the fourth field is the
customer's phone number, put a texbox labeled Phone on the form with a control
source

=cboCustomer.Columns(3)
 

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

Similar Threads

Auto fill not working 2
Auto Fill 1
Combo Box Values 5
Combo Box Problems 1
Auto fill of fields 4
field duplication in tables 9
Auto-Fill text box to text box w/ EDIT capabilities 3
required field in form 3

Top