Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2008

    Unanswered: Writing data into text file in ms access

    Dear All,

    Im working on small project that needs me to write data from the table into a text file and save as csv(comma seperated).

    I honestly dont know how to go about it.

    Will greatly appreciate any assistance.


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    marshall your data (work out what the query required is)

    then OPEN a file for OUTPUT, work out if you are going to create a new file (consider how you make the filename unique, work out the location)
    write data to the file: using, columns, from, the, table, separated, by, commas
    close the file

    build in some error trapping in case the file already exists or you run out of space

    alternatively itf its a table dump then consider and export
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2004

    This is a real simple way

    but you can use a macro (it's best do it in vb code if you can).

    Select Transfer Text
    Transfer Type: Export Delimted
    Table Name: The name of your query or table that you are exporting
    File Name: The file path you want to write to. Make sure to end with the csv extension
    You know, I'm sick of following my dreams, man. I'm just going to ask where they're going and hook up with 'em later

  4. #4
    Join Date
    Nov 2007
    Adelaide, South Australia
    ▲ Agreed... kinda. I hate macros though, so I'd do it with a DoCmd.TransferText command.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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