Full Version: Auto Export Query To Excel Daily
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
mjhopler
I need to export a query daily to Excel and have it save in a specific location. I have reviewed multiple threads that are similar to this, but none that really get me what I need. I have seen that you might be able to do this via VBA code, but don’t know how to write that.

My query name is “qryDRPJobTracking”.

Can this be exported daily without me having to click on anything each day?
theDBguy
Hi,

Will your database be running 24/7? Otherwise, you might be able to use the Task Schduler to perform that function.

Just my 2 cents... 2cents.gif
River34
This link may help you.

http://office.microsoft.com/en-us/access-h...A001225813.aspx

ScottGem
As dbGuy alludes to, You can't run Access code unless the database containing that code is open. The way I do this is to have a separate front end with an autoexec macro to run the code (The TransferSpreadsheet methos is what you are looking for). I then use Windows Task Manager to open that front end over night. The code does the export and closes the front end.
mjhopler
The database is saved on the network. There is code IT department built that disconnects and closes all databases every night. I don't shut my computer down every night, but sometimes do. Do you have to be restarting your computer to get the task manager to work?
theDBguy
Hi,

QUOTE (mjhopler @ May 16 2012, 09:21 AM) *
The database is saved on the network. There is code IT department built that disconnects and closes all databases every night. I don't shut my computer down every night, but sometimes do. Do you have to be restarting your computer to get the task manager to work?

Codes in a database will only work if the database is also running. Tasks in the Task Manager will only work if the computer is running. So, yes, you have to restart your computer if you shut it down, or else, no code will execute.

Perhaps you could ask your IT to schedule the task on the server so you don't have to keep your computer on all the time?

Just my 2 cents... 2cents.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.