Hi,
I try to add a lookup field in a dataset at runtime.
The dataset is created at runtime.
_lkField := TStringField.Create(p_rsCu
stomers);
_lkField.FieldName := 'lkcountry';
_lkField.FieldKind := fkLookup;
_lkField.DataSet := p_rsCustomers;
_lkField.Name := p_rsCustomers.Name + _lkField.FieldName;
_lkField.KeyFields := 'countryID';
_lkField.LookupDataSet := p_rsCountrys;
_lkField.LookupKeyFields := 'countryid';
_lkfield.LookupResultField
:= 'wordingfr';
p_rsCustomers.FieldDefs.Ad
d( _lkField.Name, ftString,20,false );
p_rsCustomers.Open;
I get an error message saying that there is no countryid field in the dataset.
I think the error is that I have no fields definition in the dataset but I cannot how to solve this problem.
Thanks for all
Sang-Do
Start Free Trial