TdbComboBox ......Fill

I have two table ...table1 and table2, and i want fill my combo with a field of Table2 (description).
The Table2 has two field (Cod and description)
when I choice the item of Combo I want assign the field(cod) of table2 on the field(tipdoc) of table1
chiroAsked:
Who is Participating?
 
victor_christovConnect With a Mentor Commented:
The simple way is to use TDBLookupComboBox where :

DBLookupComboBox.DataField := 'TipDoc';
DBLookupComboBox.KeyField  := 'Cod';
DBLookupComboBox.ListField := 'Description'
DBLookupComboBox.ListSource.DataSet.Name:= 'DataSource2';

and

DataSource2.DataSet.Name := 'Table2';

TipDoc is from DataSource1, connected with Table1. If you don't want to use automatic replacement of TipDoc values to Table1, use can get the value of DBLookupComboBox.KeyValue and make replacement in your programm.

Regards, Victor
0
 
chiroAuthor Commented:
you are the best ..thank
0
All Courses

From novice to tech pro — start learning today.