Combo Box and Two Fields

R

rap43

To add a new record in a form, I am using a combo box to load a table from
another table. The table I am loading to has two fields that I’d like to load
with one combo box. I like to choose two fields in the combo box and load
both fields in the record I am creating.
 
B

Bob Quintal

To add a new record in a form, I am using a combo box to load
a table from another table. The table I am loading to has two
fields that I’d like to load with one combo box. I like to
choose two fields in the combo box and load both fields in the
record I am creating.
Give the combobox rowsource as many additional fields as you
want.Bind the controlsource of the combobox to the first column of
the table.
Make the control source of the additional fields =combobox.column
(n) where n is the zero-based index into the columns of the
combobox. This will show them on the form, but will not store the
additional columns in the table. They should not be stored
anyways, they should always be lookedup when you need them in a
form or report.
 
J

Joel

rap43 said:
To add a new record in a form, I am using a combo box to load a table from
another table. The table I am loading to has two fields that I’d like to load
with one combo box. I like to choose two fields in the combo box and load
both fields in the record I am creating.
You select a row in a combobox ... thus selecting a row does select both
of your fields. The bound column is the default value returned from the
combobox and can be refenced directly by just the combobox name. You
reference the fields of the selected row by referencing their column
(which is zero based). YourComboboxName.Column(0) refernces the 1st
column. YourComboboxName.Column(1) references the 2nd column.
 

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