Recent

Author Topic: DBLookuPComboBox or....  (Read 5307 times)

james

  • New Member
  • *
  • Posts: 13
DBLookuPComboBox or....
« on: February 22, 2011, 05:36:05 am »
I'd like to use the subject to add the content of the listsource field to an edit box.  There is no datasource/datafield used.
"Caption" isn't the answer.  DBLookuPComboBox.KeyField doesn't work.  All I get is a field name.  What does one use?

sorinr

  • New Member
  • *
  • Posts: 19
Re: DBLookuPComboBox or....
« Reply #1 on: February 22, 2011, 07:13:21 am »
Hi James,

Something like edit1.text:=dblookupcombobox1.ListSource.Name ?

Regards

james

  • New Member
  • *
  • Posts: 13
Re: DBLookuPComboBox or....
« Reply #2 on: February 22, 2011, 07:53:24 am »
Thanks for the answer, but that just displays the datasource name...


sorinr

  • New Member
  • *
  • Posts: 19
Re: DBLookuPComboBox or....
« Reply #3 on: February 22, 2011, 09:08:26 am »
Do you need the selected value of the combo displayed in an editbox?
If yes: edit.text:=combo.text; with the code on combo's 'on change' event.
« Last Edit: February 22, 2011, 10:53:46 am by sorinr »

james

  • New Member
  • *
  • Posts: 13
Re: DBLookuPComboBox or....
« Reply #4 on: February 22, 2011, 05:49:38 pm »
That displays the Listfield content.  That isn't what I want, but thanks for the answer.

I think I need to clarify what I am trying to do.

The combobox uses a ListField called prov_name and this is a lookup list of province and state names.

The KeyField is called prov_code and is a lookup list of province and state abbreviations.

So, if the province name is 'British Columbia', and I click on British Columbia, the edit box needs to contain 'BC'.

Similarly, if the state is California, 'CA' needs to appear in the edit box.

james

  • New Member
  • *
  • Posts: 13
Re: DBLookuPComboBox or....
« Reply #5 on: February 23, 2011, 12:28:15 am »
Problem solved.

One query to populate the combobox and one more to populate the edit box using the combobox caption.  Painful compared to another Pascal offering.............