0

Is there a database component allowing for navigating through an attached dataset with a combobox look & feel? Upon setting the DataSource, a specifiable field would be 'loaded' into the Items property, and when the user selects an item, the dataset navigates to the selected record. Does such a component exist?

3
  • Guess, I haven't made myself clear - of course I know that.. Let me try it a different way: I am looking for dbnavigator functionality in a combobox-like component - does that clear it up?
    – tua
    Nov 18 at 17:00
  • I'm not aware of a DB-aware ComboBox that works quite the way you describe. Normally the items are fixed and selecting an item just updates the current record. For what you want, I would suggest using a standard TComboBox and handle the DB potion manually. Query the DB for the desired field and add the found items to the list. Then when an item is selected, query the DB for the desired record using the selected item. Nov 18 at 18:03
  • That's what I have been doing so far. A few rather expensive component suites (such as Woll2Woll's InfoPower) have components that come close, but would be overkill in my case. It's a question that has been raised multiple times here over the years - just wondering if something had crept up lately ...
    – tua
    Nov 18 at 18:54

1 Answer 1

2

You can achieve this with a TDBLookupComboBox omitting the DataSource and DataField property. You have to link the ListSource to your actual data source, the KeyField to the field used for the order and the ListField to the field(s) to be displayed.

6
  • Ah - a solution so close to home!
    – tua
    Nov 19 at 17:44
  • Hmm - yes, the data gets loaded, but navigation doesn't happen when I select an item. Furthermore, after loading, the current item does not show as text...
    – tua
    Nov 19 at 17:50
  • Can you explain your expectations in more detail? I have no problem to achieve what you describe in your question. I connected a TDBGrid to the same DataSource as the combobox ListSource and each selection moves the current grid row to the selected record.
    – Uwe Raabe
    Nov 19 at 17:58
  • @UweRaabe he wants to navigate a database based on what's selected in the ComboBox. Tua: you will need to use an event of the TDBLookupComboBox to navigate, such as TDBLookupComboBox.OnCloseUp, check the TDBLookupComboBox.KeyValue and use that value to navigate. Nov 19 at 21:09
  • @JohnEasley, that is exactly what I get when doing what I proposed.
    – Uwe Raabe
    Nov 19 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.