How to use DBLookupCombobox? lazarus / 16-Databases ---------------------------------------------------------------------- Hansvb · 2023-01-15 09:50 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 · 2023-01-17 21:21 Can you provide test data (Planten.db file)? ---------------------------------------------------------------------- Hansvb · 2023-01-21 11:36 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.