Forum > Databases

How to use DBLookupCombobox?

(1/1)

Hansvb:
Hi,

I am using query1 to retrieve data from a table. Then I retrieve a code list with query2. I display this code list in a dbgrid using a dblookupcombobox. It works fine the first time. (small error, i see the ID value and not the Name value).
When I run query1 again to retrieve data from another table, I get the warning that a query1 field x is not found. The query is good because if it runs the first time then I don't get an error. If I don't assign a dblookupcombobox to the dbgrid then I can repeat query1 as many times on different tables with different fields as I want. It works.
Somehow the dblookupcombox seems to hold some realtion with query1which I can't find. Unfortunately, the debugger does not provide any information about what is going wrong.

I created an example (for Windows) which shows my errors...

When you click on the treeview node, PD_KLASSE,  you get 1 record in the DBGrid. The column 'STAM_ID' in the DBgrid does show the value '1'. I expected to see the value 'stam'. See the attachment. How can I see 'stam' instead of 1? (1 is the ID field).

then, when i click on an other tree node i get an error. See the attachment. It has something to do with the dblookupbox but i can not find it. Has anyone an idea?

dseligo:
Can you provide test data (Planten.db file)?

Hansvb:
Hi,

Attached is the file plants.db
I think I've finally found it. If I create a DBLookupCombobox runtime with every treeview node change and first destroy the possibly old one, it seems to work. I need to test some more.
It seems that there remains a relationship between the DBLookupCombobox and the datasource1/query1 that I cannot find.

Navigation

[0] Message Index

Go to full version