Retriving more than one value from a combo box

G

Guest

I hae a combo box that has 3 columns, I used a wizard to generate the combo
box and I am getting one of the values to the table feild I want but I also
need to get another value from the same combo box and send that info to the
same table.
Form Combo 121 Column 2 is going to table (A) feild 1 and I am also wanting
Form Combo 121 Column 3 to go to table (A) field 2.

Thank You in advance
Mal
 
W

Wayne Morgan

You shouldn't need (or want) to do this. The values of the columns should be
related and one of the columns should have a unique value for each row in
the combo box. The column with that unique value should be the Bound Column,
the column being stored in table (A). If you need the other values, you
would create a query with table (A) and the table supplying the data for the
Row Source of the combo box and link the two tables on the common field. You
can then get the values of the other columns in that query. The link will
make sure that they "line up" with the correct record.
 
G

Guest

Wayne Morgan said:
You shouldn't need (or want) to do this. The values of the columns should be
related and one of the columns should have a unique value for each row in
the combo box. The column with that unique value should be the Bound Column,
the column being stored in table (A). If you need the other values, you
would create a query with table (A) and the table supplying the data for the
Row Source of the combo box and link the two tables on the common field. You
can then get the values of the other columns in that query. The link will
make sure that they "line up" with the correct record.

--
Wayne Morgan
MS Access MVP




Thanks for responding to a novice
The difficulty that I am running into is that my combo box is linked to a table call ded combo and the form that I have my combo in is linked to a table called home. there is no relationship between the 2 because the Ded table is a rate table only. I am using the combo box to bring rates into my form for calculations only.

Thank you
Mal
 
W

Wayne Morgan

The rate table is probably a standard rate based on some criteria, such as
Rate 1 is for overnight shipping, Rate 2 is for ground shipping, etc. There
should be a unique identifying field in the rate table for each of these
rates. That would then be the field that is aligned with the Bound Column of
the combo box and will go into the form's table. You would then create a
link between these two tables on those fields. You probably wouldn't want
this ID field to show in the combo box, so you would set the width of that
column to 0 on the Format tab of the combo box's Properties sheet.

To get a different column to also go into the table, place a textbox on the
form that is bound to the second field. In the AfterUpdate event of the
combo box add code to update the value of the textbox to the value of the
appropriate column of the combo box. When the record is saved, the value of
that other column will also be saved. You will want to lock this textbox or
set its Visible property to No.

Example:
Me.txtMyTextbox = Me.cboMyCombobox.Column(1)

The column index number is zero based, so 0 is the first column, 1 is the
second, etc.
 

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