combo box or list box

  • Thread starter Thread starter Paul Roddy
  • Start date Start date
P

Paul Roddy

I want to be able to select from a drop down list, the CustName, but I want
the form to enter the CustID so that the relation is maintained. There must
be a way to do that on a form, but I'm missing it altogether.

any help would be really appreciated.
 
Hi Paul,

That is exactly the purpose of a combo box. The combo box control allows you
to Store one thing while displaying something else. The combo box also
allows you to display several columns when the control is expanded (or
dropped down). The *hidden* column is often the first column but it can be
any column in the Rowsource by setting the ColumnWidth property correctly.
If your combo has 3 columns, Custid and CustName, PhoneNum then the
ColumnWidths property might contain:

0,1.5,1

This tells Access to hide the first column and display 1.5 inches of the
second (Name) and 1 inch of the third (PhoneNum). The first non-zero width
column will be the one that is displayed in the Control. The BoundColumn
property of the control dictates which column has the value that is stored
in the control. In your example it would be 1.
 
Paul Roddy said:
I want to be able to select from a drop down list, the CustName, but I want
the form to enter the CustID so that the relation is maintained. There must
be a way to do that on a form, but I'm missing it altogether.

Both ComboBoxes and ListBoxes can have multiple columns. When using multiple
columns you make one of them the "bound" column and can make some or all of the
others invisible by setting their ColumnWidth property to zero. In that way you
can show one value while storing another.
 
Back
Top