TIP - Database new lookupfield with Zeos Access lazarus / 63-Database ---------------------------------------------------------------------- Eigil · 2017-08-18 18:24 I've been trying to create a lookupfield in a grid for hours, and it works in design mode but when I run the program, I always got the error  "Can not perform opration on an inactive dataset".  I have searched online and in the forum and can see that more people have the same problem. I have not been able to find a solution online.  I then tried to do a test in Delphi6 just as in Lazarus here an error occurred when I defined new lookupfield in design mode with ZQueryXX set  to active = true if active = false then ok.   I then do the test in Lazarus by setting ZQueryXX to false before "RUN" and put in my case ZQuery1.active = true and ZTable1.active = true in the FormCreate method.  Then the lookupfield in the grid was ok. (Lazarus 1.6.4 and 1.8RC4) I hope this can be used by other in the forum. Thank you for all the help that can be found here. ---------------------------------------------------------------------- GAN · 2017-08-18 19:58 I've had those kinds of mistakes in my early days with Zeos and I don't remember what my mistake was. Could you show the code or attach the project? ---------------------------------------------------------------------- Eigil · 2017-08-19 12:52 Yes no problem. J have made a small example for test in a zip-file. J use MySql as database and have export the example data in af file named "test.sql" There is also a Word file "info" with screen cuts. Hope you can use it. ---------------------------------------------------------------------- GAN · 2017-08-21 16:37 I think, because I can't test it (no have MySql), you only need to make de connection like this: 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 TForm1.FormCreate(Sender: TObject);begin  ZConnection1.Connect;  ZQuery1.Active:=true;  ZQuery2.Active:=true;;end;   BTW you also can use ZQuery1.Open instead ZQuery1.Active:=True (it's the same). ---------------------------------------------------------------------- Eigil · 2017-08-22 20:02 If it can help I have attach a example with sqlite-3. Change the "LibraryLocation" in "ZConnection1" to the folder where you have the sqlite3.dll for your machine WIN32 or WIN64. ---------------------------------------------------------------------- GAN · 2017-08-23 00:45 See the attached file, it's working! On ZConnection1 write the full path to your db (or browse it). The solution was close all connections in desing mode, then on the FormCreate event first open Zconnection1 , Zquery2,  Zquery1 in this order: 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 TForm1.FormCreate(Sender: TObject);begin  if ZConnection1.Connected then ZConnection1.Disconnect;  ZQuery1.Close;  ZQuery2.Close;  ZConnection1.Connect;  ZQuery2.Open;  ZQuery1.Open;end; Regards, GAN.