Search code examples
ms-accessvbams-access-2016

MS Access VBA DoCmd.TransferText How to Separate Columns?


The following line should import a semi-colon ; delimited .csv text file to a table.

DoCmd.TransferText TransferType:=acImportDelim, SpecificationName:=specNote, TableName:="tblImport", FileName:="K:\path\file.csv" 

However this puts all the fields in one field.

What is going wrong here?

Any suggestions?

I specified

  • File format: Delimited
  • Field delimiter: ;

I set this through the import wizard and saved this specification. With the wizard all went good.

I want to share the specification but I dont know how to do that?

Many thanks.


Solution

  • Is specNote a variable or the name of your specification?

    If the latter, try:

    DoCmd.TransferText _
    TransferType:=acImportDelim, _
    SpecificationName:="specNote", _
    TableName:="tblImport", _
    FileName:="K:\path\file.csv"