Board index » delphi » Bound Combo that translates db value

Bound Combo that translates db value

Does anyone know how or know a control which displays a Combo box of
fully spelled state names and will store the state abreviation.

Basically I need a control which can display on value and store
another.

Thanks
Blake

 

Re:Bound Combo that translates db value


Here's how:

1) Create a table and call it STATES (or whatever).  

2) Create 2 fields called STATE which is of type CHAR(2) and STATENAME
which is of type CHAR(20).  Make STATE the unique key field.

3) Use Database Desktop (or other tool) to populate the table with all 50
state abbr. and names

4) Then drop a TTable and TDatasource on your form and point it to this
STATES table.

5) Then drop a TDBLookupCombo on your form and
   set the LookupSource to be the TDatasource of the STATES table
   set the LookupField to be the STATE field
   set the LookupDisplay to be the STATENAME field
   set the DataSource to be the TDatasource of your main table
   set the DataField to be the field you want to store the 2 character
state abbr.

Hope this helps.

Quote
On Monday, May 06, 1996, Blake Versiga wrote...
> Does anyone know how or know a control which displays a Combo box of
> fully spelled state names and will store the state abreviation.

> Basically I need a control which can display on value and store
> another.

> Thanks
> Blake

Other Threads