Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2004, 01:53 PM
Authorized User
 
Join Date: Oct 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Automatic E-mail Generated based on query

I am using Access 97. I have created a database. I need to send an e-mail alert to a person telling them the issue needs to be dealt with in the next seven days. The other e-mail will send an e-mail to pass due issues.

- The e-mail needs to be sent at 7:00 a.m. every morning to the different individuals who have issues that need to be resolved.

-Another e-mail to the people who have over due issues.
 
Old March 19th, 2004, 06:36 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You will have to use a Windows OS scheduler to do this, Just make sure that you create a separate file that does only this task to ensure that another user will not be using an mdb that is used as a scheduled job. Use Windows NT Server or Win 2K Server scheduler.

If you have SQL Server, you can use the SQL Server Job Agent.



Sal
 
Old March 24th, 2004, 02:38 PM
Authorized User
 
Join Date: Oct 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sal:

I have set up this in scheduler. What do I need to do to get the e-mail to execute in Access. Is there some code I need to write into my module to auto execute this.

Betsy

Quote:
quote:Originally posted by sal
 You will have to use a Windows OS scheduler to do this, Just make sure that you create a separate file that does only this task to ensure that another user will not be using an mdb that is used as a scheduled job. Use Windows NT Server or Win 2K Server scheduler.

If you have SQL Server, you can use the SQL Server Job Agent.



Sal
Betsy
 
Old March 24th, 2004, 03:19 PM
Authorized User
 
Join Date: Feb 2004
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I suggest you look at the DoCmd.SendObject Method or the SendObject Action. Much of this depends on your email client and the libraries you have installed. Alternatives include CDO libraries and Outlook (not Express) automation code.

Ciao
Jürgen Welz
Edmonton AB Canada
[email protected]
 
Old March 25th, 2004, 09:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If, by chance, your company is still using old versions of Windows and Outlook (which thankfully (in this case only) mine does), you can have the email sent automatically using
Code:
DoCmd.SendObject
with the EditMessage argument being False. If your company uses newer versions of Windows and Outlook, this isn't as easy, as Microsoft have "fixed" this very useful "bug", and don't allow sending without user intervention.

So you'll end up with code like:
Code:
DoCmd.SendObject acSendQuery, "YourQuery", _
acFormatXLS, "Someone@somewhere", , , "Some Subject", _
"Some Body Text", False
DoCmd.Quit
If you have an autoexec macro run that code on startup, it will send that query, then quit when the database is opened.

If you don't want to use an autoexec macro, you can use another macro, and specify that in the startup parameters of your schedule - eg:
"C:\Program Files\Office\msaccess.exe" "X:\YourFile.mdb" /x macrotorun

HTH

Steven

I am a loud man with a very large hat. This means I am in charge





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send an automatic email alert Based on Date/time lakshmi_annayappa ASP.NET 1.0 and 1.1 Basics 3 May 28th, 2007 12:07 AM
auto generated mail id vijaypalada ASP.NET 1.0 and 1.1 Basics 2 January 20th, 2007 05:50 PM
subform based on a query Vince_421 Access VBA 2 May 10th, 2006 04:38 AM
Encoding problem with automatic mail on hotmail robbielove ASP.NET 2.0 Professional 0 April 28th, 2006 07:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.