Results 1 to 2 of 2
  1. #1
    ExtremeNovice is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2017
    Posts
    24

    Access 2016: How to export a report as a .csv file and auto-name the file from entered data

    Hello,
    I am building a database for my office and I am learning Access as I go. I've got two questions that I hope have answers other than "you can't do that."

    1. How can I export a file as a .csv file?

    .csv file format is not offered as an option if you try to export to excel. When I exported as a text file and manually change the file extension to .csv it did save as the correct file type but the data was pretty badly scattered about the spreadsheet with odd spacing and several of my fields of information were merged into single cells which pretty much makes it useless for my purposes.

    2. Can I set my export file name to auto-generated based on information in the report that is being exported?

    Currently the export file name default is the name of the report, I would like the exported file to be named after the 'Date' and 'InvoiceNumber' (two fields that are in the report) automatically without me having to manually type that information in every time I export a file.



    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    .csv is not an excel file. To export to .csv via access, you must build an export spec.
    manually export a file, click text, in the applet, bottom left corner click advanced button,
    set the spec: delimiters, fixed or not, etc.
    save the spec name. Use this in the transfer command:

    vFile = "c:\folder" & me.txtReport & ".csv"
    docmd.TransferText acExportDelim ,spec,query,vFile,true

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Export Access table data to flat file (txt file)
    By edmscan in forum Import/Export Data
    Replies: 3
    Last Post: 06-17-2015, 12:03 PM
  2. Replies: 13
    Last Post: 12-12-2013, 07:22 PM
  3. Replies: 15
    Last Post: 07-10-2013, 01:27 PM
  4. Replies: 1
    Last Post: 01-24-2013, 11:47 PM
  5. Replies: 2
    Last Post: 08-05-2012, 06:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums