Syntax for Import Into from Different DBs - MS Access

断了今生、忘了曾经 提交于 2019-12-24 08:48:08

问题


I'm trying to do (basically) an automated row copy from one backend to another as the backend is being used but is not fully developed (some tables are done, others not; adding the completed data into the more advanced db at the end of the day).

I'd like to know what the syntax is for an SQL statement which:

INSERT INTO tblMyBetterTable * IN "C:\\path_to_db\db.accdb"
FROM tblMyTable IN "C:\\path_to_in_use_db\in-use-db.accdb"

The syntax is not correct but I've searched for a while and can't find out how.. I've seen how to import from one table to another etc, but not across backends. If it's not clear, I'd like to basically do a table copy of all rows in in-use-db.accdb from tblMyTable to the latest version of the backend db.accdb's table tblMyBetterTable.


回答1:


I suggest you try DoCmd.TransferDatabase

For a query, you need something on the lines of:

SELECT * INTO NewTable 
FROM [;DATABASE=Z:\Docs\Test.accdb].Table1

Or the other way round:

SELECT * INTO [;DATABASE=Z:\Docs\Test.accdb].NewTable
FROM Table1

To insert into an existing table:

INSERT INTO table1 
SELECT * 
FROM [;DATABASE=Z:\Docs\Test.accdb].Table1


来源:https://stackoverflow.com/questions/10918605/syntax-for-import-into-from-different-dbs-ms-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!