Solved Schedule the sending of a report by e-mail, every working day at a certain time. (1 Viewer)

georg0307

Registered User.
Local time
Today, 19:08
Joined
Sep 11, 2014
Messages
91
Dear all,

I have Office 2013, Is it possible schedule the sending of a report by e-mail, every working day at a certain time?

Is it possible do it via VBA?

Best regards,

Georg
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:08
Joined
May 7, 2009
Messages
19,247
you can use a Form and on a Form use it's Timer Event to send the email.
the form need not be visible.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 12:08
Joined
Feb 28, 2001
Messages
27,223
You can certainly have a hidden form with a timer event. However, the problem is that to do anything, the DB must be open. If the DB is not open, timer-based code will not be running. There is also the issue that if there is more than one user running the DB, you might not wish to have each one send out the same message at the same time.

A solution that has been offered before is to do the following:

1. Write a macro in your database to perform a RunCode operation. (See next entry in this list for the code to run.) The macro last step must be an Application Quit
2. Write a FUNCTION (important; can't be a subroutine if used in a macro) to do the SendMail operation
3. Write a batch script to launch Access and use the /X:macro-name option on the command line.
4. Use Windows Task Scheduler to run the script at the required time of day. Because the SendMail option will involve (at the minimum) an SMTP operation, you must be running the script as a user who CAN send mail. Some site rules prevent SYSTEM from doing so, depending on domain startup files.

All of this will require research into domain rules. Some domain admins disallow Windows Task Scheduler usage anyway.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:08
Joined
Feb 19, 2002
Messages
43,346
Take a look at www.fmsinc.com -- they have a large selection of utilities one of which schedules processes for you.
 

Users who are viewing this thread

Top Bottom