Access query to export query to csv file with time and date via a module

I have a query called qry_export (SQL Query below if needed) that pulls up a simple query with 2 columns and I want to export the results to a csv file called

Export_MM_DD_YYYY.pft   where the MM DD YYYY is of course the date

The format of the csv file needs to be


I would like to do this via a module if possible. I have used the runsavedimportexport function in the past but in this case I need to put the current date into the file and that will not work for me.

Any ideas?

SQL Code for query

FROM Bb_Alpha1
WHERE (((Bb_Alpha1.[PORTFOLIO DESC]) Not Like "*test*") AND ((Bb_Alpha1.[BB TICKER]) Is Not Null));
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.

Rey Obrero (Capricorn1)Commented:
first you need to create an Export Specification

1.right click on the table/query 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

'use this codes to export the query
dim csvFile as string
csvFile="Export_" & Format(Now(),"MM_DD_YYYY") & ".csv"

DoCmd.TransferText acExportDelim, "ExportSpecName", "NameOfQuery", "C:\folder\" & csvFile , True

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
wilpitzAuthor Commented:
Thanks! Perfect!!!!
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.