Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Provided Answers: 1

    Unhappy Unanswered: Send email from outlook 2013 using access 2016

    Hello All,
    I am really hoping to get some guidance from the gurus here. I have done a lot of research on this issue and found codes but none of them are working for me.

    Let me explain:

    I would like to send customized email (BCC) to multiple recipients using outlook by simply clicking a button. I have a query that filters monthly birthdays and displays them in report.

    what code do I need that will use outlook to send email to those recipients wishing them a happy birthday?

    This is my query to filter out monthly birthdays.
    SELECT DISTINCTROW Members.*, MemberTypes.MemberType AS MemberTypeDesc, Members.Status
    FROM MemberTypes INNER JOIN Members ON MemberTypes.MemberTypeID = Members.MemberType
    WHERE (((Members.Status)="Active") AND ((Month([Birthdate]))=Month(Now())));

    Any help is appreciated.

  2. #2
    Join Date
    Apr 2014
    Provided Answers: 35
    in a form you have a listbox
    this listbox is tied you your query above showing those having bdays to send to. name , email
    put a button on the form to execute email send.
    when user clicks the button, it scans the list gets email and sends text....

    private btnSend_click()
    end sub
    Public Sub ScanAndEmail()
    Dim vTo, vSubj, vBody, vRpt
    Dim vFilePath
    dim i as integer
    For i = 0 To lstEAddrs.ListCount - 1
       vRpt = lstEAddrs.ItemData(i)
       lstEAddrs = vRpt
       vTo = lstEAddrs.Column(2)
       vBody = "body of email"
       vSubj = vRpt
       vFilePath = ""  'path of the snapshot or XL or PdF
       Call Email1(vTo, vSubj, vBody)
    End Sub
    'YOU MUST ADD THE OUTLOOK APP IN REFERENCES!!!   checkmark OUTLOOK OBJECT LIBRARY in the vbE menu, Tools, References
    Public Function Email1(ByVal pvTo, ByVal pvSubj, ByVal pvBody,optional ByVal pvFile) As Boolean
    Dim oApp As Outlook.Application
    Dim oMail As Outlook.MailItem
    On Error GoTo ErrMail
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(olMailItem)
    With oMail
        .To = pvTo
        .Subject = pvSubj
        .Body = pvBody
        If Not Ismissing(pvFile) Then  .Attachments.Add pvFile, olByValue, 1
    End With
    EmailO = True
    Set oMail = Nothing
    Set oApp = Nothing
    Exit Function
    MsgBox Err.Description, vbCritical, Err
    Resume Next
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts