Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2475
  • Last Modified:

Saving Access 2010 Query Results to a CSV formatted file

I have created an Access 2010 query that sends over 800,000 results.  I want to use VBA to run the query and send the results to a comma delimited CSV file.

Do I use the DoCmd.TransferText command to do this?

Thanks

Glen
0
GPSPOW
Asked:
GPSPOW
1 Solution
 
Rey Obrero (Capricorn1)Commented:
<Do I use the DoCmd.TransferText command to do this?> yes, but

you need to create an export specification first..

1.right click on the table/query
2.select export > Text file
   click on Browse and locate the destination folder
3. (you can accept the proposed name or change it)
click Save, then click OK
4. In the export text wizard select the type (Delim / Fixed width)
5. Follow the wizard, before clicking on Finish
     5a .Click Advanced
6. In the Export Specification dialog box Field Information List, correct any descrepancies

7. click save as, give the specification a name <-- this is the specification name that you will use in the command line below


DoCmd.TransferText acExportDelim, "ExportSpecName", "TableQueryName", "C:\myCsv.csv", True
0
 
chris bennettsCommented:
I have tried this, it does not work.

I have 3 million rows output by a query, and this just crashes when going to "Export Text" and tells me that it can only paste 65000 rows to the clipboard

please advise..

thanks
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now