Combo Box Brain Freeze

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to put a combo box on a form that will select information from another
table and store only the code from that table. Better described below.

Form - frmSearchName
Uses Table - Summons
Field for Combo Box - Type

The combo box will draw from table tblType which has two fields, TypeCode
and TypeDescr.

My problem is that I want the description (TypeDescr) to display on the
form, but the code (TypeCode) to be stored in the Summons table. Using the
wizard, it bind the field to TypeCode and stores it just fine, but also
displays this info on the form. I know this is simple and that I've probably
done it before .... still looking for an example in one of my other database
..... and drinking my morning coffee!!!!
 
Sash said:
I want to put a combo box on a form that will select information from
another
table and store only the code from that table. Better described below.

Form - frmSearchName
Uses Table - Summons
Field for Combo Box - Type

The combo box will draw from table tblType which has two fields, TypeCode
and TypeDescr.

My problem is that I want the description (TypeDescr) to display on the
form, but the code (TypeCode) to be stored in the Summons table. Using
the
wizard, it bind the field to TypeCode and stores it just fine, but also
displays this info on the form. I know this is simple and that I've
probably
done it before .... still looking for an example in one of my other
database
.... and drinking my morning coffee!!!!

In your combo box control: set the Bound Column property to 1 and set the
Column Widths property to something like 0";1". This will "hide" the first
column (TypeCode) while leaving it as the bound column, which means it's
that value that gets copied into the bound field (Type).

Carl Rapson
 
Use this ---
SELECT [TypeCode], [TypeCode]& " - " & [TypeDescr] FROM [tblType]
Columns 2
Bound column 1
Column Widths 0"; 2.5"
List Width 2.5"
The second column width and list width to be whatever is necessary to display.
 
Setting the ColumnWidth for Column 1 to 0" should do what you want. 0";1"
 
PERFECT and easy. Thanks Carl and Karl!!!

Carl Rapson said:
In your combo box control: set the Bound Column property to 1 and set the
Column Widths property to something like 0";1". This will "hide" the first
column (TypeCode) while leaving it as the bound column, which means it's
that value that gets copied into the bound field (Type).

Carl Rapson
 
Back
Top