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!
kaleelee21Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kaleelee21Author Commented:
MacroShadow - Yes, it's submitted with a button click.
0
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.