Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Help with VBA Code to Send Email From Access via Outlook

Posted on 2017-10-12
Low Priority
Last Modified: 2017-10-13

I have the following code called to execute on_click in an Access database.  It has worked fine so far and sends an email without the user being prompted by Outlook.  However, some people have recently been updated from Outlook 2010 to 2013 and the emails are no longer being sent.  I have a separate code that sends emails (with user prompt) and that is working fine regardless of Outlook version.  The database was created in Access 2010 and almost everyone uses Runtime 2010 to use it.  Can someone please tell me if there is a compatibility issue at work here or something like that?  Please note I replaced the outgoing email addresses with "XXXXXX" for privacy reasons.  Thanks very much for your help.


Public Sub SendMailCCPT()

    'Late binding
    Dim olapp As Object
    Dim olmail As Object
    Const olmailitem As Long = 0
    Set olapp = CreateObject("outlook.application")
    If olapp Is Nothing Then
        MsgBox "Outlook is not open. Please open Outlook and try again."
    Set olmail = olapp.CreateItem(olmailitem)
    With olmail
        .Subject = "Project or Training Impacting " & Forms!EditSchPT!txtMyDept & " on " & Forms!EditSchPT!txtDate
        .body = Forms!EditSchPT!txtMyName & vbNewLine & Forms!EditSchPT!cPTDesc1 & ": " & Forms!EditSchPT!txtPTDesc1 & vbNewLine & "Start: " & Forms!EditSchPT!txtPT1St & vbNewLine & "End: " & Forms!EditSchPT!txtPT1End
    End With
    End If
    Set olapp = Nothing
    Set olmail = Nothing

End Sub

Open in new window

Question by:Baron Feilzer
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 52

Expert Comment

by:Gustav Brock
ID: 42329553
It works fine here with Access/Outlook 2016, so the issue is probably some setting in Outlook 2013 that has changed.

LVL 85
ID: 42329776
Do you receive an error, or does it simply not work?

Is the email created, but not sent?

Author Comment

by:Baron Feilzer
ID: 42329874
Hi. I don't get any indication that the email is created. I also don't get any error either.  The only thing I have been same to figure it's there is some conflict going from Access 2010 to out look 2013

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Join & Write a Comment

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question