Results 1 to 3 of 3
  1. #1
    David Sabot is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    2

    Export Query Result into CSV

    I have a query that pulls some data from various tables. I would like it to automatically run somehow daily and take the results and put them into a CSV file in a specific directory. The CSV file should be MM-DD-YY.csv so it doesn't overwrite the existing data. Any advice on how to accomplish this?



    << NOTE >> I am sorry, I should have put this in the Import/Export thread. I don't want to crosspost. Mod can you help?

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Have you looked at the TranferText macro/vba method?

    One of the parameters provides for "Export Delimited".
    You might construct the exported file name as
    "C:\Somedirs\" & Date() & ".csv" (I'm not sure whether or not the file type is automatically created.)
    As far as running the export daily, there are a couple of possibilities. The simplest path might be to have Windows start the database with a command line parameter specifying the maco which you want to run. Google 'access command line'
    Basically it looks like this: C:\somepath\Dbname /x dumpmacro

  3. #3
    thhui is offline Competent Performer
    Windows XP Access 2002
    Join Date
    Feb 2009
    Posts
    235
    Use macro to automate the export task

    Something like that:-

    CurrentYMD = DateSerial(Year(Date), Month(Date), Day(Date))
    mmddyy=format(CurrentYMD, "mm-dd-yy")

    DoCmd.TransferText acExportDelim, , mmddyy & ".csv", True

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

Similar Threads

  1. Export Query Result to Excel
    By chewbears in forum Access
    Replies: 11
    Last Post: 11-28-2011, 08:31 AM
  2. VB ADO Query Result Set
    By Bedsingar in forum Access
    Replies: 5
    Last Post: 09-05-2011, 10:45 AM
  3. Evaluate result of sql query
    By Tyork in forum Programming
    Replies: 2
    Last Post: 11-09-2010, 05:41 PM
  4. Export a simple query result to an excel file
    By wop_nuno in forum Import/Export Data
    Replies: 1
    Last Post: 05-21-2009, 04:18 AM
  5. Result of Count Query not known elsewhere
    By Carole in forum Access
    Replies: 1
    Last Post: 09-07-2008, 09:39 AM

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