Solved

How To Automate an Export to CSV from an Access Query

Posted on 2011-02-24
5
573 Views
Last Modified: 2012-05-11
I created a query that will produce a list of only the products that have price changes in effect. The query needs to be exported to a csv file and be uploaded to an FTP site. I would like to automate the exporting of the query - so that it will be less complicated for certain individuals.

I have tried creating a module "ExportQuery with the following code:

Function ExportQuery()
DoCmd.TransferText acExportDelim, , "[qryPriceList]", "[NewPrices].csv"

End Function

I get an error stating it cannot find qryPriceList - and to make sure it is spelled correctly. It is spelled correctly - so I am a little lost here - any help would be greatly appreciated  
0
Comment
Question by:dawber39
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34976353
remove the square brackets and specify the full path to the csv file


DoCmd.TransferText acExportDelim, , "qryPriceList", "C:\YourFolderName\NewPrices.csv"
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34976358
you may also need an export specification to create a good csv file..

what version of Access are  you using?
0
 

Author Comment

by:dawber39
ID: 34976404
I am using 2007 but I will be implementing its use in 2003 - that does seem to work - is there a way I can get it to retain the column headers - because the program that is reading it - starts at the second row assuming report headers
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 34976418


add the option to add the field names

DoCmd.TransferText acExportDelim, , "qryPriceList", "C:\YourFolderName\NewPrices.csv",true
0
 

Author Closing Comment

by:dawber39
ID: 34976441
You people ROCK!!!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question