dblookupcombo display value

My dblookupcombo when it shows is empty.How can I have it display a record
when it shows?
srbenavrbeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.