clara said:
It works and it is what I need, but I am still confused about control source
and bound column. Could you give me a brief introduction plus an example
The Control Source of any bound **control** (including combo
boxes) contains the name of the **field** in the form's
Record Source table/query that stores the value of the combo
box.
A combo box's Bound Column specifies which field in the
combo box's Row Source table/query is used to set combo
box's value, regardless of whether the combo box is bound or
unbound.
An trivial example might be where you have a form with
Record Source
SELECT CustomerName, Phone, CountryID
FROM Customers
The form would have one text box for the name and another
for the phone number. Since you do not want to give users
an opportunity to exercise their innovative spelling skills
on country names, you have a separate Countries table with a
country ID number in column one and the country name in
column two. The form would then use a combo box with:
ControlSource CountryID
RowSource Countries
BoundColumn 1
ColumnCount 2
ColumnWidths 0;1.6
The ColumnWidths property indicates that the ID field will
not be displayed to users so they only see the country name.
However, the BoundColumn indicates that the ID field will
used to set the combo box's Value.
The combo box's ControlSource indicates that the ID value
will be saved in the CountryID field.
Side Note: A reason for saving the ID value in the
customers table instead of the country name is just in case
you want to change the country name (e.g. you decide to use
GB instead of UK), you can change it without having to go
back and modify all the customer records for that country.