lazarus DBGrid lookup field (no creation) lazarus / 16-Databases ---------------------------------------------------------------------- asimkon · 2020-06-11 16:35 I have been using Lazarus 2.x with Firebird 3 (via flamerobin) and i have got two tables: appeals with a foreign key (promoter_id) and promoter (id,fullname). I would like to create a lookup field for DBGrid with field properties from dataset appeals and lookup fields from dataset promoter. Thus i have got the following script: 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 interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, DBGrids,Unit3,DB; type   { TForm5 }   TForm5 = class(TForm)    DBGrid1: TDBGrid;    procedure FormShow(Sender: TObject);    procedure showgrid;    procedure showlookup;  private   public   end; var  Form5: TForm5; implementation {$R *.lfm} { TForm5 } procedure TForm5.FormShow(Sender: TObject);begin //showlookup; showgrid; showlookup;end; procedure TForm 5.showgrid;begin  appeals.SQLQuery2.Close; appeals.SQLQuery2.SQL.Text: ='select * from appeals where datediff(day,cast(''Now'' as date),cast(date_judgement as date))<5 and date_court IS NOT NULL';  ap peals.DBConnection.Connected:=True; appeals.SQLTransaction1.Active:=Tr ue; //appeals.SQLQuery2.Open;  //appeals.DataSource1.DataSet:=appeals. SQLQuery2; //DBGrid1.DataSource:=appeals.DataSource1;  DBGrid1.Columns .Items[1].Width:=120; DBGrid1.Columns.Items[0].Visible:=false; DBGrid1 .Columns.Items[1].Title.Caption:='Name'; DBGrid1.Columns.Items[2].Titl e.Caption:='Date Entry'; DBGrid1.Columns.Items[3].Title.Caption:='Date Suspension'; DBGrid1.Columns.Items[4].Title.Caption:='Date Examination'; DBGrid1.Columns.Items[5].Title.Caption:='Date Final'; DB Grid1.Columns.Items[6].Title.Caption:='Promoter'; end; procedure TForm 5.showlookup;begin  appeals.SQLQuery4.Close; appeals.SQLQuery4.SQL.Tex t:='select id,fullname from promoter'; //appeals.SQLQuery4.Open;  DBGr id1.Columns.Items[6].Field.FieldName:='promoter_id'; DBGrid1.Columns.I tems[6].Field.FieldKind:=fkLookup; DBGrid1.Columns.Items[6].Field.KeyF ields:='promoter_id'; DBGrid1.Columns.Items[6].Field.LookupDataSet:= a ppeals.SQLQuery4; DBGrid1.Columns.Items[6].Field.LookupKeyFields:='id' ; DBGrid1.Columns.Items[6].Field.LookupResultField:='fullname'; DBGrid 1.Columns.Items[6].Field.DataSet:=appeals.SQLQuery2;  appeals.SQLQuery 4.Open; appeals.SQLQuery2.Open;  appeals.DataSource1.DataSet:=appeals. SQLQuery2; DBGrid1.DataSource:=appeals.DataSource1;end; end.                                                                                          As soon as i run it, i receive the following error (attached) or in text description ElistError:ListIndex (1) out of bounds. Additionally I have played with my code by running and opening first the queries but no lookupfield is shown in Promoter column grid (only numbers and no text description). Unfortunately there is no bibliography or code examples of creating lookup fields or computed in Lazarus IDE. Any help would be convenient to me! Regards