create a unit with a procedure lazarus / 16-Databases ---------------------------------------------------------------------- Glewins · 2018-12-25 01:08 I use Win 10, Laz 1.8.2, FPC 3.04, Zeos 2.4... What I would like to do Is create a unit, that has a procedure that populates a dbgrid or fields. example  on formshow event, I call Populatemydb(dm.dmod.QSE, thesqltext:stringg); in unit a procedure called populatemydb(Thequery:tzquery, 'SELECT * FROM EMPLOYEE order by EMPID ); PopulatemydbThe query:tzquery); begin  try    if not thequery.active then thequery.Active := true;    thequery.sql.text := thresqltext;   thequery.open;  Except   on e:exception do     begin       showmessage(E.Message+'Error in Executing SQL '+thesqltext+'!');      end;    end; Finally   // do something else end; I have used this with Delphi and Absolutedb, but no luck with Zeos & Firebird and Lazarus. George ---------------------------------------------------------------------- Thaddy · 2018-12-25 09:35 If it works in Delphi it should also work in Lazarus. Not enough information to help you. ---------------------------------------------------------------------- mangakissa · 2018-12-25 09:49 This is really a standard procedure that works even in older verions. What's the problem ---------------------------------------------------------------------- MacWomble · 2018-12-25 12:01 If this is your source-code then it never will run. Please copy and paste and use format 'code' for this. ---------------------------------------------------------------------- Glewins · 2018-12-26 18:01 You are right.  It won't run.  I have solved the problem. I sat down with pencil and paper and thought about what I wanted, did not take long.  Just needed to see the whole picture.  Thanks.  George.