[Solved] DBLookupCombobox & DBGrid lazarus / 16-Databases ---------------------------------------------------------------------- folkeu08 · 2022-09-01 13:25 Hi All, I have 2 SQLite tables managed by 2 SQLQuery, one "Year" and the other "Outgoing Mail". In the DBLookupComboBox appears the values ​​of the "Year" table. In the grid, I'm looking to show only the rows that are identical to the 'id_year' field present in each table. They are joined by a ForeignKey. is indeed a DBLookupComboBox that I have to use for this selection of the year or another component (DBCombobox, ...). In SQL, do I need to do a table join? I add the source too. thanks Fokeu ---------------------------------------------------------------------- Zvoni · 2022-09-01 15:11 You have to add a Filter in your SQL Aircode! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SQLDBGrid.SQL.Text:='SELECT * FROM DBGridTable WHERE Year=:YearParam'; SQLDBGrid.ParamByName('YearParam').AsInteger:=DBLookupCombo.text.ToInt eger;SQLDBGrid.Open;//Refresh DBGrid ---------------------------------------------------------------------- folkeu08 · 2022-09-02 07:41 Hi Zvoni, Thanks for this help. I applied the changes to my source and I got a compile error which makes sense. I have an "illegal qualifier" error for this part: AnneeCourrierSortant_DBLookupComboBox.Text.toInteger -> courrierframe_unit.pas(161,129) Error: Illegal qualifier Text and integer are incompatible. In a property, no way to apply 'strtoint'. I re-added the edited source. I continue this research in this direction. Folkeu ---------------------------------------------------------------------- folkeu08 · 2022-09-02 08:07 Hi, We can replace the "Text.ToInteger" by the "KeyValue" because when I select another year, I get the KeyValue from the integer value of the year of the "id_year" field. Now, it is necessary to make this value coincide with that of the grid to display only the selected one. I use a Showmessage (IntToStr(AnneeCourrierSortant_DBLookupComboBox.KeyValue) to verifie the value. I advance ! Folkeu ---------------------------------------------------------------------- folkeu08 · 2022-09-02 08:42 Hi all, I found ! The source code is attached for the correct selection when opening the file. All you have to do is add some code to the OnChange of the DBLookupComboBox. thanks Folkeu ---------------------------------------------------------------------- Zvoni · 2022-09-02 10:18 Quote from: folkeu08 on September 02, 2022, 09:41:20 amHi Zvoni, Thanks for this help. I applied the changes to my source and I got a compile error which makes sense. I have an "illegal qualifier" error for this part: AnneeCourrierSortant_DBLookupComboBox.Text.toInteger -> courrierframe_unit.pas(161,129) Error: Illegal qualifier Text and integer are incompatible. In a property, no way to apply 'strtoint'. I re-added the edited source. I continue this research in this direction. Folkeu Arggh! I always forget that for Type-Helpers you have to include the Unit and/or have to set a Modeswitch(?) ---------------------------------------------------------------------- folkeu08 · 2022-09-02 11:49 Hi Zvoni, it does not matter because you allowed me to go to another technique that I knew how to exploit. Thanks Folkeu