Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I am trying to export a table from Access, to a .txt file. If I hope the table and complete the export "manually" everything works fine. Using code to do it automaticially, the txt file is created, but contains just the data, and not the column header information. I used the export wizard to create a specification file, and an using the following code to get the .txt file generated.

    DoCmd.TransferText acExportDelim, "Test Export Specification", "tblAllWeekLimited", "C:/Temp/Test.txt"

    Do I need to call out the header information specifically? When I ran the export wizard (twice to confirm) I checked "include header names", but still they do not carry through.

    Thanks.

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Smokey,

    You need one more parameter {see below}

    Quote Originally Posted by SmokeEater View Post
    DoCmd.TransferText acExportDelim, "Test Export Specification", "tblAllWeekLimited", "C:/Temp/Test.txt",True
    From the Access VBA Help File {search term TransferText}.
    HasFieldNames Optional Variant. Use True (1) to use the first row of the text file as field names when importing, exporting, or linking. Use False (0) to treat the first row of the text file as normal data. If you leave this argument blank, the default (False) is assumed. This argument is ignored for Microsoft Word mail merge data files, which must always contain the field names in the first row.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts
    So close....and yet so far.

    That did it! Thanks!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •