Microsoft Access 2007 和 Microsoft Access 2007 VBA与CSV 和...的东西
我有一个出于工作目的的作业,这并不难做,但我不是一个熟练的访问用户,所以我特此来找你们:)
我要编写实际上是自定义 CSV 文件的 VBA 代码装载机。它将解析一些文件并将其内容插入到适当的表中。 我的问题是:创建此加载程序并触发它的最合适的方法是什么? 我想我必须在我的数据库项目中创建一个 VBA 模块,但是用户调用脚本并加载文件的可能性是什么? 就像...是否有任何文件系统浏览器控件可以弹出打开并要求用户选择 csv 文件然后加载它或其他文件?
谢谢你们的提示,
Miloud B
I have an assignment for work purpose which isn't really hard to do but I'm not a proficient access user so I, hereby, come to you guys :)
I'm about to write VBA code that is actually a custom CSV files loader. It's going to parse some files and insert their content in the appropriate tables.
My question is: What is the most appropriate way of creating this loader and triggering it?
I guess I have to create a VBA Module in my database project, but then what are the possiblities for the user to invoke the script and load the files ?
Like... is there any file system browser control that I can pop open and ask the user to choose a csv file then load it or whatever else ?
Thank you for your hints guys
Miloud B
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从用户的角度来看,创建一个表单(或一系列表单)来引导他们完成导入过程可能是最简单的方法。然后您可以将 VBA 代码附加到这些表单中。
您可以使用 FileDialog 让用户选择文件。当您想要在任何其他 Windows 程序中打开文件时,会出现相同的对话框。 Microsoft 在此处解释了如何使用它。这不是最清楚的解释,但如果您谷歌“Access FileDialog”或“Access OpenFileDialog”,您可以找到更多示例。
From the user's point of view, it is probably easiest for you to create a form (or a series of forms) to take them through the import process. You can then attach your VBA code to those forms.
You can use the FileDialog to let the users select a file. It's the same dialog box that comes up when you want to open a file in any other Windows program. Microsoft explains how to use it here. It's not the clearest explanation, but if you Google "Access FileDialog" or "Access OpenFileDialog" you can find more examples.
看看
DoCmd.TransferText acImportDelim/acLinkDelim
Have a look at
DoCmd.TransferText acImportDelim/acLinkDelim
对于用户来说,最简单的方法是右键单击表,导入,选择数据,选择导入位置。
For the user the easiest will be to use right click on tables, import, select the data, choose the place to import to.