SOLVED: Passing results from a Query to a new one lazarus / 16-Databases ---------------------------------------------------------------------- SaraT · 2020-02-07 05:07 Hi guys I have two component: 1- Query1 (created in designtime) 2- Query2 (created in runtime) Is there a way to get the results of Query1 and pass the results of Query1 to Query2 component? The case is that I don't want to use Query2.SQL.Text I have tried with the below code but I got a "Access violation" error. 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 Query2.DataSource.DataSet := Query1.DataSource.DataSet; Any idea? Many thanks. ---------------------------------------------------------------------- HeavyUser · 2020-02-07 06:30 depends on the destination query but in short you need to 1) duplicate the source query internal schema (fieldDefs, and fields collections) 2) call query1.createdataset to create the internal buffers. 3) write a loop to copy each row of the source query field by field to an appended row on the destination query. ---------------------------------------------------------------------- mangakissa · 2020-02-07 07:37 use TBufdataset. ---------------------------------------------------------------------- rvk · 2020-02-07 07:59 Quote from: SaraT on February 07, 2020, 06:07:37 amIs there a way to get the results of Query1 and pass the results of Query1 to Query2 component? The case is that I don't want to use Query2.SQL.Text Maybe you can also explain WHY you don't want to use SQL.Text. Maybe that reason is easilly (and better) fixed than your imagined solution.