Solved

How To Automate an Export to CSV from an Access Query

Posted on 2011-02-24
5
563 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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Combobox issue 4 27
Loop within Select Case 3 27
How add a field with sequential numbers to a form 7 26
Square brackets 4 12
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now