用于将新数据从Excel导出到Access的代码 [英] Code to export new data from Excel to Access

查看:89
本文介绍了用于将新数据从Excel导出到Access的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出一种方法,将从Excel应用程序输入到Excel 2003电子表格的任何新数据导出到Access 2003数据库中。我已经看到很多代码源自Access应用程序,但我想避免进入Access来执行此操作。用户每天都会在Excel中输入数据,但每天都没有人在Access中 - 并且信息需要是最新的,因为它是另一个应用程序(Infopath 2003表单)的来源,它也将每天使用。 br />

只需要复制新输入的数据,主键不在Excel表格中。


我是新手到VBA,所以任何帮助都非常感谢。如果我不明白这一点 - 最终我必须每天手动传输数据,这似乎是错误的!

解决方案

Anna,欢迎来到Bytes!


我建议只从Access中创建Excel表的链接......这样你就不必担心任何凌乱的代码。


@beacon


感谢您回复Beacon!

不幸的是,链接赢了'不行,因为这样做实际上并没有传输数据。为了让InfoPath从Access表中提取数据,数据必须驻留在Access中 - 它不会通过链接从Excel中提取数据。我对于让这3个MS程序一起工作变得多么困难我感到很惊讶!!


这不是简单的安。它涉及需要正确处理的各种问题。其中包括:

  1. 应用程序自动化
  2. 管理哪些单元格(可能是行)是新的和已导出的单元格。
  3. 首先从Excel导出数据(没有直接导出到Access中的选项或以某种方式确保Access只导入新数据(如果从Excel导入)。



这是你要做的事吗?


I am trying to figure out a way to export any new data entered into an Excel 2003 spreadsheet into an Access 2003 database from the Excel application. I''ve seen lots of code originating in the Access application, but I want to avoid having to go into Access to do it. The users will be entering data into Excel daily, but no one will be in Access daily- and the info needs to be up to date because it is a source for another application(an Infopath 2003 form)which will also be used daily.

Only the newly entered data would need to be copied, and the primary key would not be in the Excel sheet.

I''m a newbie to VBA, so any help is really appreciated. If I don''t figure this out- it''s going to end up with me having to MANUALLY transfer the data everyday, which just seems wrong!

解决方案

Hi Anna, welcome to Bytes!

I suggest just creating a link to the Excel table from within Access...that way you don''t have to worry about any messy code.


@beacon
Thanks for responding Beacon!
Unfortunately, linking won''t work because doing so doesn''t actually transfer the data. In order for InfoPath to pull it''s data from the Access table, the data has to be resident in Access- it won''t pull it from Excel via the link. I''ve been astonished at how hard it is turning out to be to make these 3 MS programs to work together!!


This wouldn''t be straightforward Ann. It involves various issues that need to be handled correctly. Among wihich are :

  1. Application Automation.
  2. Managing which cells (presumably rows) are new and which already exported.
  3. Exporting the data from Excel in the first place (There is no option to export directly into Access) or somehow ensuring Access imports only the new data if it imports from Excel.


Is this something you''re up for?


这篇关于用于将新数据从Excel导出到Access的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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