[SOLVED] DBGrid Index lazarus / 16-Databases ---------------------------------------------------------------------- madref · 2019-03-20 22:23 I have a query with multiple tables. In this query I can have ID's that can have the same number but with a different. Letter attached to it. So it can be 12 R or 12 L, with other things attached to it. I used this code to locate the ID (which is in this example 12) 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 TQ_Evaluaties.Locate('ID', Save_ID, []);But when I have to number 12's it goes wrong. Is it possible to get the DBGrid Index number so that I can select the correct index when I for example have edited the data in a different form? This is the actual code I use. 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 procedure TForm_Evaluatie_Overzicht.BT_EditClick(Sender: TObject);var Save_ID, Save_WD: Integer;    Save_RL: string;    fel2005: TForm_Evaluatie_2005_Linesman;    fel2018: TForm_Evaluatie_2018_Linesman;    fel2019: TForm_Evaluatie_2019_Linesman;    fer2005: TForm_Evaluatie_2005_Referee;    fer2018: TForm_Evaluatie_2018_Referee;    fer2019: TForm_Evaluatie_2019_Referee;begin  if TQ_Evaluaties.RecordCount = 0 then begin    Form_Message.MsgWindow(mUitroep, bOK,      'There is no Evaluation to Edit !! ' + sCrLf +      'First add a Evaluation !!', PrgNaam);    Exit;  end;  Save_ID := TQ_Evaluaties.FieldByName('ID').AsInteger;  Save_WD := TQ_Evaluaties.FieldByName('Wed_ID').AsInteger;  Save_RL := TQ_Evaluaties.FieldByName('TBL').AsString;  case Save_RL of    'R': begin           case Save_ID of  // Save_ID = 4 -=> Test rapport           2, 3,             5..10  : fer2005 := TForm_Evaluatie_2005_Referee.Create(Self);             11..14 : fer2018 := TForm_Evaluatie_2018_Referee.Create(Self);           else           fer2019 := TForm_Evaluatie_2019_Referee.Create(Self);         end; // case           try             case Save_ID of  // Save_ID = 4 -=> Test rapport               2, 3,               5..10  : fer2005.ShowEvaluatieReferee (Save_ID, Save_WD);               11..14 : fer2018.ShowEvaluatieReferee (Save_ID, Save_WD);             else             fer2019.ShowEvaluatieReferee (Save_ID, Save_WD);           end; // case           finally             case Save_ID of             2, 3, 5..10 : fer2005.Free;               11..14 : fer2018.Free;           else               fer2019.Free;             end; // case         end;  // try         end;  // Referee    'L': begin           case Save_ID of  // Save_ID = 14 -=> Test rapport             2..13,             15..23 : fel2005 := TForm_Evaluatie_2005_Linesman.Create(Self);             24     : fel2018 := TForm_Evaluatie_2018_Linesman.Create(Self);           else             begin  // alle andere zijn nieuwe rapporten gemaakt in 2018-2019 en erna.               fel2019 := TForm_Evaluatie_2019_Linesman.Create(Self);             end          end; // case          try            case Save_ID of  // Save_ID = 14 -=> Test rapport              2..13,              15..23 : fel2005.ShowEvaluatieLinesman (Save_ID, Save_WD);              24     : fel2018.ShowEvaluatieLinesman (Save_ID, Save_WD);            else            begin  // alle andere zijn nieuwe rapporten gemaakt in 2018-2019 en erna.                fel2019.ShowEvaluatieLinesman (Save_ID, Save_WD);              end            end; // case           finally             case Save_ID of               2..13, 15..23 : fel2005.Free;               24 : fel2018.Free;             else             fel2019.Free;             end; // case           end;  // try       end;  // Linesman  end;     // case  TQ_Evaluaties.Refresh;  TQ_Evaluaties.Locate('ID', Save_ID, []);end;     // BT_EditClick ---------------------------------------------------------------------- madref · 2019-03-20 22:35 Next Time I have to google first before asking a question here. Found my own solution AGAIN  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 TQ_Evaluaties.Locate('ID;TBL', VarArrayOf([Save_ID, Save_RL]), []); It's explained here http://wiki.freepascal.org/locate