Automate Access 2010 module to export query to tab delimited text file

I have a query called qry-EXPORT that I need to be able to export via module in Access 2010. I need to export this file to C:\Temp and the file name needs to be DataExport.txt

I have been able to do this via the Export Text file option in Access, and have even saved the steps to do this but I need to automate this process of exporting the file via windows scheduler and I think that I can do this via a module the best.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
use the TransferText method.  Syntax looks something like:

docmd.TransferText  acExportDelim, [SpecificationName], [Table Or Query Name], "C:\temp\DataExport.txt", True
Rey Obrero (Capricorn1)Commented:
use this codes to automate the export, place the codes in a regular module

Function ExportFile()
docmd.RunSavedImportExport ("Name Of Saved Export")

end function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
To create [SpecificationName] as referenced by Dale, you must first export the query ONCE, manually.  On the last form of the dialog, click the Advanced button.  That is where you will specify the format for the export and also save it.  Once it is saved, you can refer to it using the TransferText method.
wilpitzAuthor Commented:
This worked with what I had in place, very easy and worked great!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.