vba 将制表符分隔的文本文件导入 Access 数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1248366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 10:40:32  来源:igfitidea点击:

Import Tab delimited Text File to Access Database

ms-accessvba

提问by Ashok Gupta

I have a tab-delimited text file and want to import it in MS Access using VBA code.

我有一个制表符分隔的文本文件,想使用 VBA 代码将它导入到 MS Access 中。

I have created an MS Access form and have used the DoCmd.TransferTextmethod:

我创建了一个 MS Access 表单并使用了以下DoCmd.TransferText方法:

DoCmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)

It works well for CSV File. I'm not sure how to do it in case of tab-delimited text files.

它适用于 CSV 文件。如果是制表符分隔的文本文件,我不确定该怎么做。

Any suggestions?

有什么建议?

回答by David-W-Fenton

Do a manual import, changing the delimiter to TAB, save the import spec, and then specify that import spec in your TransferText command.

执行手动导入,将分隔符更改为 TAB,保存导入规范,然后在 TransferText 命令中指定该导入规范。