Solved

How To Automate an Export to CSV from an Access Query

Posted on 2011-02-24
5
568 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
  • 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

840 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