skafy Posted February 21, 2019 Share Posted February 21, 2019 Hi, I'm having problems with assignment of a dblookupcombobox's value. I yould like to auto fill dblookupcombobox if there is only one record. I cannot find out how. if dsData.DataSet.RecordCount = 1 then begin dsData.DataSet.First; dblookup.KeyValue := dsData.DataSet.FieldByName(dblookup.KeyField).AsVarit; end; when i check dsData.DataSet.RecordCount there is more than 0 values. how can i achive this. Quote Link to comment Share on other sites More sharing options...
Mike Posted March 5, 2019 Share Posted March 5, 2019 I would like also know how to set the first (only) record active in a DBLookupCombobox. Quote Link to comment Share on other sites More sharing options...
skafy Posted March 21, 2019 Author Share Posted March 21, 2019 I think i managed to solve it by setting DataSource field at its value and not selecting ListSource value. something like that UniDBLookupComboBox1.DataSource.DataSet.FieldByName(UniDBLookupComboBox1.DataField).AsString:= UniDBLookupComboBox1.ListSource.DataSet.FieldByName(UniDBLookupComboBox1.ListField).AsString but I still moved from DBLookupCombobox to DBComboBox for better managing of data. Hope it helps Quote Link to comment Share on other sites More sharing options...
Mike Posted March 22, 2019 Share Posted March 22, 2019 Thanks. It is working. Quote Link to comment Share on other sites More sharing options...
ainsama1 Posted June 20, 2019 Share Posted June 20, 2019 may i know how did you do it? Quote Link to comment Share on other sites More sharing options...
zhyhero Posted June 20, 2019 Share Posted June 20, 2019 unidblookupcombobox1.keyvalue:=unidblookupcombobox1.listsource.dataset.fieldbyname(unidblookupcombobox1.keyfield). value Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.