Jump to content

DBLookupComboBox set value


skafy

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.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

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

Link to comment
Share on other sites

  • 2 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...