Copy an entire table from one Access db to another continued lazarus / 16-Databases ---------------------------------------------------------------------- dodgebros · 2020-03-06 04:04 I saw this post https://forum.lazarus.freepascal.org/index.php/topic,3 3341.msg215902.html#msg215902 and ran the SQL statement 'INSERT INTO [website].arcust01 SELECT * FROM [accounts].arcust01' within Access and it worked perfectly.  BUT how do you run the SQL statement in Lazarus since you have to use two odbc connections, one for each Access DB?  I tried this: DataModule1.ODBCConnection1.ExecuteDirecrt('INSERT INTO [website].arcust01 SELECT * FROM [accounts].arcust01').  I did not get any errors but nothing was copied either. These are the two connections: ODBCConnection1 connects to Access DB accounts.mdb ODBCConnection2 connects to Access DB website.mdb. I hope I explained my question well enough for you guys to help me and thanks in advanced! TD ---------------------------------------------------------------------- af0815 · 2020-03-06 07:46 In short, you cannot join two connections in a query. You have to read the data from the first connection with first query, buffering it and write it to the second connection with a second query. The sample you linked is only working if you transfer data from one table to a second table in the same database (and connection). ---------------------------------------------------------------------- cdbc · 2020-03-06 10:29 Hi Wouldn't it be possible to get around that little problem, with f.i. using the trick from TMemDataset...? 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 CopyFromDataset(DataSet : TDataSet; CopyData : Boolean); {$IFNDEF FPC} overload; {$ENDIF}... Then use this table to copy record for record to the new TQuery/TTable...? Just my 2 cents  hth - Benny ---------------------------------------------------------------------- Zvoni · 2020-03-06 10:50 Or you just attach your target-table as a linked table to your source- database (or vice versa), and be done with it...... EDIT: Or do the right thing, and put the MicroShit-Crap where it belongs: Into the rubbish-Bin. Convert your mdb's to SQLite, and with SQLite you can even attach/detach from an SQL-Statement. https://www.sqlitetutorial.net/sqlite-attach-database/ ---------------------------------------------------------------------- MoCityMM · 2020-03-15 09:17 Quote from: dodgebros on March 06, 2020, 05:04:43 amThese are the two connections: ODBCConnection1 connects to Access DB accounts.mdb ODBCConnection2 connects to Access DB website.mdb. Is there a website associated with these databases? And what is it running on (IIS/Apache, .Net,PHP)?