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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Events - Send Email

Status
Not open for further replies.

FrChopin

Technical User
Jan 11, 2004
4
US
Is it possible to have an email automatically sent
when a certain condition is met. I am using
MS Access 2000...started a simple caseworker database with 10 or so fields in my CasworkerTable. One of the fields is DateCaseClosed and another is CaseworkerAssigned
Data is entered on a simple form.

After 30 days have elapsed from the DateCaseClosed date I would like to have an email sent to person listed as CaseWorker Assigned.

Can someone point me in the right direction....

Thanks
 
Something like this, maybe?

Code:
Public Sub gsubSendEMail(sAddressee As String, iKeyID As Integer)
'--NOTE:  use of this procedure requires a reference to the
'--MICROSOFT OUTLOOK 10.0 OBJECT LIBRARY

Dim sSubject As String
Dim sBody As String
Dim objOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem

'--set subject and text of message:
sSubject = "Your Subject Line Here"
sBody = "Something happened that requires your attention."

'--create Outlook object and email:
Set objOutlook = New Outlook.Application
Set MyMail = objOutlook.CreateItem(olMailItem)
            
'--set address, subject, and text:
With MyMail
    .To = sAddressee
    .Subject = sSubject
    .Body = sBody
    .send
End With

'--clean up:
Set MyMail = Nothing
Set objOutlook = Nothing

End Sub

< M!ke >
 
My PC has MS Windows 2K, and MS Access 2K, and MS Outlook.
I have already created a query that provides me the desired output.
I want to:
1. every day at 7:00 AM and at 3:00 PM, this query gets executed and I get the results in an Excel sheet.

I have successfully created a macro to run the query and send me the output in an Excel format to my email address.

I do not know how to make this task automated and scheduled.

I looked into the 'Add Scheduled Task" in Windows 2K, but it will only start the MS Access application.

I also need to define which database to pick and which Macro from that database should be executed.


Thanks,
Indiana
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top