Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

dblookupcombo display value

My dblookupcombo when it shows is empty.How can I have it display a record
when it shows?
0
srbenavrbe
Asked:
srbenavrbe
  • 3
  • 2
  • 2
1 Solution
 
mokuleCommented:

You should set KeyValue

mokule
0
 
calinutzCommented:
In the DBLookUpComboBox you must set the properties ListSource to the DataSet ythat you want to display, then the Listfield to the field that you want displayed and then the keyfield to the field that you want to use (without showing it).
For example if your table contains agents that have a name <<name>>, and an unique code <<code>> then
If you want to use the code for your coding purposes not the name but the code is not relevant for the user then assign the keyvalue to the code field and the listvalue to the name field.
Cheers
0
 
calinutzCommented:
So you can use 2 fields from the same record using the DBLookUpComboBox. One you can use to show it to the user and in the background you can use the other for your coding purposes. If you need anymore help just ask.
Cheers
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
srbenavrbeAuthor Commented:
It is not problem linking to datasource but there is no value visible
when it shows.I I would like a value showing.
(For classic combo you would set its itemindex to 0 or 1..)
0
 
mokuleCommented:
I've already answered.

You should set KeyValue
0
 
srbenavrbeAuthor Commented:
mokule,can you tell me how and where?
new to this...
0
 
calinutzCommented:
In designtime you mean?
In runtime all you need is to set the propertyes as I specified above and if you don't get your value shown then perhaps you should place this in your prefered event (AfterOpen, FormShow etc.):

DBLookUpComboBox1.KeyValue:=AdoQuery1.FieldValues['agent'];
where AdoQuery1.FieldValues['agent'] should point to the keyField assigned in the keyfield property of the DBLookUpComboBox

It works for me
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now