自动化Access中的数据导出和导入 [英] Automating Data export and import in Access

查看:77
本文介绍了自动化Access中的数据导出和导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库A分布在广泛的地理区域内的21个不同的代理商。他们都使用Access 2007来运行数据库。总公司有一份数据库A的副本,并希望它存储来自其所有边远机构的所有数据。这将要求每个机构将数据导出到文本文件并通过电子邮件发送给总部。总公司的用户然后将这些数据导入现有数据库,将所有记录附加到其相应的表格。


我想让这个过程成为一个单击选项。有没有一种方法可以创建一个按钮,其中包含一个导出自上次导出以来添加到数据库中的所有数据的过程?


我也在寻找一次点击将数据导入总部数据库的选项。


有人曾经这样做过吗?请非常感谢任何帮助

Database A is distributed across 21 different agencies in a wide geographic area. They all use Access 2007 to run the database. Head office has a copy of database A and would like to have it store all the data from all its outlying agencies. This would require each agency to export the data to a text file and email it to head office. The user at head office would then import this data into the existing database appending all records to its appropriate table.

I want to make this process a one click option. Is there a way in which I can create a button with a procedure that exports all the data that was added to the database since the last export?

I am also looking for a one click option to import the data back into the database at head office.

Surly someone had done this before? Please any assistance would be greatly appreciated

推荐答案

好的,你看看是否将查询导出为文本文件。您需要一个查询来将数据细化为自上次导出后添加的数据。这假设您有一个唯一的标识符,它是一个自动增量数字,因为您可以存储最后发送的记录的ID,并设计一个查询以仅显示id大于该值的记录。您需要添加一个表来存储上次发送的id的值。


然后您可以设置该查询的导出并保存2007允许您执行的导出步骤。


现在看看DoCmd.TransferText函数。
OK so have you looked at exporting a query as a text file. You would need a query to refine the data to that added since last export. This assumes that you have a unique identifier that is an autoincrement number as in you could store the id of the last record sent and design a query to show only those records with an id greater than that. You would need to add a table to store the value of the last id sent.

You could then set up an export of that query and save the export steps which 2007 allows you to do.

Now look at the DoCmd.TransferText function.
展开 | 选择 | Wrap | 行号


如果要自动导入 ,至少由进程处理代码在发送到总部后,必须以标准方式完成。这些文件必须具有标准名称并存储在标准文件夹(或文件夹结构)中。


实际上,就像许多海报一样,你似乎确信你应该理解它应该是多么简单。对,没有任何真正的理解问题。这当然可以做到,但是如果它不是一团糟就需要考虑和计划。如果你能够放下一些(更精确的)思想,那么就可以取得进步,但这本身就是一个项目。这不是Access已经或甚至应该已经准备就绪的东西。
If it''s to be imported automatically, at least the process handled by the code, after being sent to head-office, then it must be done in a standard way. The files must have standard names and be stored into a standard folder (or folder structure).

Actually, like many posters, you seem sure your understanding of how straightforward it should be must be right, without any real understanding of the issues. This can be done of course, but it will need consideration and planning if it''s not to end up a mess. If you can put down some of your (more precise) thinking then progress can be made, but this is a project in itself. This is not something Access has, or even should have really, ready as a bolt-on.


Microsoft确实在过去创建了分布式软件。使用复制的数据库设计确实会造成很多麻烦...

对于Access 2007 Microsoft创建/扩展了Sharepoint服务器方法来处理这种类型的数据交换情况。然而,缺点是额外成本:-(


使用上面提出的导出基本数据并将其导入主数据库的方法将需要添加代理商代码所有基本数据都可以通过将结果发送到ftp位置来实现自动化,因此可以轻松处理收集数据


Nic; o)
Microsoft did create in the past the "distributed" database design using replication, something that did cause a lot of trouble...
For Access 2007 Microsoft created/expanded the Sharepoint server approach to handle this type of data exchange situations. The downside is however the additional cost :-(

Using the above proposed approach of exporting the essential data and importing it into the "master" database will require the addition of the agency code to all basic data and could be automated by sending the result to an ftp location so collecting the data can be handled "easily"

Nic;o)

这篇关于自动化Access中的数据导出和导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆