如何使用单个规范通过VBA链接Access 2010中的多个表 [英] How to use a single specification for linking multiple tables in Access 2010 via VBA

查看:88
本文介绍了如何使用单个规范通过VBA链接Access 2010中的多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过VBA链接访问中不同列的多个.txt文件。我已将链接规范命名为GCELL_Specification并使用以下代码。

问题是Access在所有链接文件中使用与标题的标题相同的标题。它弄乱了所有链接文件。任何人都可以告诉我如何使用单个规范链接不同标头的多个表。

或者任何人都可以告诉我如何在没有规范的情况下进行链接,以便默认情况下每个表的访问都采用数据类型。我尝试了这个,但访问给出错误3011.

我使用的代码是:



I want to link multiple .txt files of different columns in access via VBA. I have made link spec named as " GCELL_Specification" and using the following code.
The problem is Access is making same headers in all linked files as the headers of Spec. Its messing all the linked files. Can anyone tell me how to use a single spec in linking multiple tables of different headers.
Or can anyone tell me how to link without spec so that access takes datatype by default for each table. I tried this but access giving the error of 3011.
The code that i am using is :

Private Sub btn_dir_Click()
Dim objFSO As FileSystemObject
Dim objFile As File
Dim ObjDirRoot As Folder

Dim PageName As String

Set objFSO = New FileSystemObject
    Set ObjDirRoot = objFSO.GetFolder("D:\Compiled DB\North")
For Each objFile In ObjDirRoot.Files
PageName = objFile.Name
DoCmd.TransferText acLinkDelim,"GCELL_Specification" , PageName, objFile.Name, True 
    Next

End Sub



谢谢高级。


Thanks in advanced.

推荐答案

看看这里: DoCmd.TransferText Method(Access) [ ^ ]



Have a look here: DoCmd.TransferText Method (Access)[^]

SpecificationName:
SpecificationName:

(...)用于分隔文本文件和Microsoft Word邮件合并数据文件,你可以留下这个参数blan k选择默认的导入/导出规范。

(...) For delimited text files and Microsoft Word mail merge data files, you can leave this argument blank to select the default import/export specifications.


这篇关于如何使用单个规范通过VBA链接Access 2010中的多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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