Automatically run a query and email

RogerC

Well-known Member
Joined
Mar 25, 2002
Messages
536
Can this can be done?

I refresh a report from a query every day. I then need to send the report to a large group of people. (All are on a shared network. All using Outlook). I would like to TOTALLY automate the process. I know Access can email reports (SendObject), but can it automatically refresh the query every day at a certain time and then email the new report without me having to do anything to make it happen each day?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Roger, you could investigate the OnTimer event on any form. By default the Timer property is set to 0, meaning it doesn't fire. You could set that to 600 so it checks every 10 minutes (increments are in seconds), and write a routine in the OnTimer event that (a) checks that the current time is less than your trigger or a flag value is 1, Exit Sub or (b) if time greater than your trigger and flag=0, run the email routine and set the flag to 1
Maybe this will get the thoughts going in the right direction? :)
Denis
 
Upvote 0
Thanks SydneyGeek! So it sounds like the whole thing can be done. Great! I will research the OnTimer event. One question, I don't actually have a 'Form' that I'm emailing... just a Report. Will the OnTimer event work on a Report as well as a Form?

What's the weather like in Sydney in December? I'm considering vacationing in Australia later this year. :)
 
Upvote 0
Hi Roger,

Quick clarification... the 'Form' doesn't need to be the thing that you are emailing. It can be a dummy form in the background, to which you attach the code. You can then run the report and email whatever you like.

As for Sydney in December... it varies. Average temps that time of year are around 26 degrees C (that's low 80s F). Long evenings (dark around 8.30 pm), but it can be a bit humid. A pretty good time of year, mostly -- but if you're here for Christmas, prepare for culture shock -- no snow...

Denis
 
Upvote 0

Forum statistics

Threads
1,221,564
Messages
6,160,513
Members
451,655
Latest member
rugubara

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top