Copying to/from Dbase data using Access

走远了吗. 提交于 2019-12-20 07:31:08

问题


I am stuck with some legacy back ends using dBase IV, and would like to be able to copy records from one table to another using an Access front end. The simple answer would be to link to the source and destination tables and run an INSERT query or similar.

However, in my situation, the back end is not a single DBF file, but there are several hundred files that I need to dynamically link to for the copy operation. Currently I have to change and refresh the link definition using the TableDefs property (in VBA) every time I wish to perform the copy operation.

The catch is the front end is shared, meaning that each user has to have a separate copy of the FE so that the linked table definitions are not modified by another user.

I was wondering is there an easy way to do this without using linked tables? I could open DAO connections to the source and destination but cannot find any simple way of copying the records (apart from one at a time). Are there anyways around this?


回答1:


It is possible to run a query using the linked DBF that inserts into a DBF in another location:

INSERT INTO [dBASE III;DATABASE=z:\docs\].[dbf2.dbf]
SELECT *
FROM dbf1;

Or

INSERT  INTO dbf1
SELECT *
FROM  [dBASE III;DATABASE=z:\docs\].[dbf2.dbf];


来源:https://stackoverflow.com/questions/11231454/copying-to-from-dbase-data-using-access

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