Import tab in txt into Access table using VBA

I am trying to import a tab txt file into an Access table using VBA. In my code, I want to insert it into a table that has not yet been created.

Here is what I tried to do. Note. I was able to do this work using CSV and not including this:DataType:=xlDelimited, Tab:=True

Sub InsertData()

    'import CSV into temp table
    DoCmd.TransferText TransferType:=acLinkDelim, TableName:="tbl_TEMP", _
    FileName:=FileNameVariable, HasFieldNames:=True, DataType:=xlDelimited, Tab:=True

End Sub

When I run this block, I get the following error on DataType:=xlDelimited, Tab:=True

Compilation Error: Named argument not found

How do I change this to pull out a tab delimited txt file so that each column from txt has its own column in Access?

+4
source share
1 answer

, -. , , , , , . , , .

, ( " " FileSystemObject, Split(s, vbTab) ..), 255 , :

CSV- Pastebin , GenericTabSpecification.csv.

Excel, 256 4 , Ctrl + C .

Access . ( .)

Import1.png

, "...".

" " ( , ..), , :

Import2.png

Ctrl + V, Excel . 255 .

Import3.png

" ..." GenericTabSpecification. , .

VBA,

DoCmd.TransferText _
        TransferType:=acImportDelim, _
        SpecificationName:="GenericTabSpecification", _
        TableName:="newTable", _
        FileName:="C:\Users\Gord\Desktop\foo.txt", _
        HasFieldNames:=False
+8

All Articles