• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 107
  • Last Modified:

Email Alerts for New Record

I am creating a database for Weekly Activity Reports. When the user submits a new Weekly Activity Report, I would like to send an alert to the current user's supervisor to notify him/her that their employee's Weekly Activity Report was submitted. The default email client is Microsoft Outlook.

Is there a way in Microsoft Access to do this?

Thanks!
0
kaleelee21
Asked:
kaleelee21
  • 2
  • 2
  • 2
1 Solution
 
MacroShadowCommented:
How is the Weekly Activity Report submitted? button click?
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You can use SendObject to do this. On the Form where your users are adding the new Weekly Activity Report, add code like this AFTER that occurs:

DoCmd.SendObject acSendNoObject, "", "", "supervisoremail@email.com", , "Weekly Activity Report", "A new Weekly Activity Report has been submitted"

https://msdn.microsoft.com/en-us/library/office/ff197046.aspx

You can also customize the message. For example, if you know the name of the report, or the person submitting it, you could do this:

DoCmd.SendObject acSendNoObject, "", "", "supervisoremail@email.com", , "Weekly Activity Report", "A new Weekly Activity Report named " & Me.txtActivityReportName & " has been submitted by " &Me.txtSubmittedBy

You can also automate Outlook to do this, but if your needs are simple then SendObject will do the trick.
0
 
kaleelee21Author Commented:
MacroShadow - Yes, it's submitted with a button click.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Then you could use the SendObject method I described earlier in that same Button Click event.
0
 
MacroShadowCommented:
Or you could automate Outlook as Scott previously mentioned.

This should give you an idea how to automate it.
Sub demo()
    Dim oApp As Object
    Dim oMail As Object
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(0)
    oMail.Body = "Body of email"
    oMail.Subject = "Test Subject"
    oMail.To = "Someone@somewhere.com"
    oMail.Send
    Set oMail = Nothing
    Set oApp = Nothing
End Sub

Open in new window

0
 
kaleelee21Author Commented:
Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now