Jump to content
uniGUI Discussion Forums
skafy

DBLookupComboBox set value

Recommended Posts

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.

Share this post


Link to post
Share on other sites

I would like also know how to set the first (only) record active in a DBLookupCombobox.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

unidblookupcombobox1.keyvalue:=unidblookupcombobox1.listsource.dataset.fieldbyname(unidblookupcombobox1.keyfield). value

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×