使用visual basic 6将数据从excel导入到访问数据库中的现有表

使用visual basic 6将数据从excel导入到访问数据库中的现有表

问题描述:

我是vb6的初学者,对Access有一点了解。我想每月将Excel(电子表格)文件中的一些记录导入到现有Access数据库的表中。



Excel文件用作每月源数据由超过两百条记录组成。数据库中的一个表将按月以Excel格式收到的源数据每月更新(不附加重写)。表上的ID字段可以接受重复值,Access表和Excel表都具有相同的列数和数据类型。



请指导我如何使用代码来执行此操作,该代码用于放置在表单上的命令按钮的单击事件以执行操作所需。



感谢您的预期帮助。



Amieen设计师



我尝试过:



我尝试了从其他网站下载的一些代码,但无法实现预期目的。大多数代码都是excel或access中的宏形式。 (VBA)

Am a beginner in vb6 with a little knowledge of Access. I would like to import some record from an Excel (Spreadsheet) file into a Table in an existing Access Database every month.

The Excel file serves as the monthly source data consisting of over two hundreds records. One of the table on the database will be updated (Append not Over-write) on a monthly basis by the source data received in form of Excel. The ID field on the table can accept duplicate value, and both the Access table and the Excel sheet has the same number of columns and datatype .

Please guide me on how to do that with a code to be used in a click event of a command button placed on a form to perform the action require.

Thanks for your anticipated help.

Amieen Designer

What I have tried:

I tried some codes i downloaded from other sites but could not achieve the desired purpose. Most of the code are in form of macros in excel or access. (VBA)

Access或Excel VBA的代码应该相当合理地转换 - 只需将其粘贴到VB6中并修复出现的任何编译错误。 />


理想情况下,你应该尽早放弃使用VB6(大多数人在几十年前这样做了)



使用更现代的语言,如VB.NET或C#等.NET语言,你会发现数百个关于如何通过适当的谷歌搜索在这两种语言中做你想做的事的例子。



我们无法帮助您,因为您还没有与我们共享任何代码 - 我们不会为您编写代码,我们只是帮助解决具体问题
The code for the Access or Excel VBA should convert quite reasonably - just paste it into VB6 and fix any compile errors as they come up.

Ideally you should drop the use of VB6 at your earliest convenience (most people did this a couple of decades ago)

Use a more modern language, a .NET language such as VB.NET or C# and you will find several hundred examples of how to do what you want in either of those languages with an appropriate google search.

We can't help you much further because you have not shared any code with us - we do not write the code for you, we just help out with specific problems