Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating an Access Query and Saving it 2

Status
Not open for further replies.

hsp7777

Programmer
Jan 11, 2005
67
0
0
US
Greetings,

I am looking for some general information which will help me accomplish the following (on a nightly basis):

1) Run an existing Access query (which resides in an Access 2000 database).

2) Save the results of this query as either an Excel file or .CSV file.

3) Email this file as an attachment to a specified email address.

At any rate, I was wondering if I could use Windows Task Scheduler to accomplish this, or is this something that would require a VB app to do? [Note: I was thinking about creating VBA code in Access to do the aforementioned tasks. I wasn't sure, however, if I could run Access/VBA code from a .bat file that is launched by Windows Task Scheduler]. Any suggestions would be appreciated.

Thanks in advance!
 
Have a look at the /x command line option of access.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi!

You can create a macro called autoexec which will run automatically when the Db is opened and you can run the code from there. Alternatively, you can make a form that (if you don't have one already) opens when the application is opened and you can run the code from the load event of the form. This option is probably better because you can make the form check the time before running the code so that it only runs when you want it to.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top