Automate exporting of query to CSV

dmyoungsal

Registered User.
Local time
Today, 09:25
Joined
May 1, 2016
Messages
112
I have a query that I would like to use and make it run every two hours automatically. Ideally, not use code (if that is possible)

I have done some searching and it seems possible, but I cannot find the correct Tool.

Your help is appreciated.
 
You make a form,set the timer properties...
Timer interval =7200000 (1000=1 sec)
(If it allows this large #)

OnTimer event, put the code to export here...
Docmd.transfertext ..

Every 2hrs , the event will fire and export.
You may need vb to make a new filename for every file. If not, it will just overwrite the same file everytime.
 
DoCmd.TransferText acExportDelim,,[TableName],DestinationPath & "Filename" & "_" & format(Now(),"yyyy-mm-dd hh_nn") &".csv",...

Same name but use a Date/Time Stamp to differentiate and Windows will AutoSort the newest to the top of the file list in the folder if you set your folder for Z-A Sorting

Just an option
Cheers!
Goh
 
DoCmd.TransferText acExportDelim,,[TableName],DestinationPath & "Filename" & "_" & format(Now(),"yyyy-mm-dd hh_nn") &".csv",...

Same name but use a Date/Time Stamp to differentiate and Windows will AutoSort the newest to the top of the file list in the folder if you set your folder for Z-A Sorting

Just an option
Cheers!
Goh

Can I use a query rather than "tablename"?
 
Sure, Queries and Views are treated just like Tables.

Cheers!
Goh
 

Users who are viewing this thread

Back
Top Bottom