Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014
    Posts
    98

    Unanswered: Automatic Email if combo box's 2nd value is selected as first is yes and 2nd is no

    Can anybody help with the code to send automatic email if combo box's 2nd value is selected for example if first value is "yes" and 2nd is "no". And also I want to send email to three people if 2nd value in the combo box of a form is selected

    Private Sub cmdSend_Click()
    Dim rst As DAO.Recordset
    Dim db As DAO.Database
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem

    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    'Set rst = db.OpenRecordset("SELECT * FROM tUsers WHERE ID=1")

    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .To = rst!Email
    .Subject = "Testing"
    .Body = "Test number one"
    .Send
    rst.Close
    Set rst = Nothing
    Set db = Nothing
    End With
    End Sub

    I have this code

  2. #2
    Join Date
    May 2014
    Posts
    98
    Private Sub Status_AfterUpdate()


    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Dim SQL As String
    Dim ManagerEmail As String


    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)


    SQL = ("SELECT ManagerEmail FROM ManagerEmailAddress Where atnStatusID = 2")


    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook

    .To = (ManagerEmail)
    .Subject = "Testing"
    .Body = "Test number one"

    Set db = Nothing
    End With
    End Sub
    Can Anyone this code what I am doing wrong

    Quote Originally Posted by jj2 View Post
    Can anybody help with the code to send automatic email if combo box's 2nd value is selected for example if first value is "yes" and 2nd is "no". And also I want to send email to three people if 2nd value in the combo box of a form is selected

    Private Sub cmdSend_Click()
    Dim rst As DAO.Recordset
    Dim db As DAO.Database
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem

    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    'Set rst = db.OpenRecordset("SELECT * FROM tUsers WHERE ID=1")

    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    With MailOutLook
    .To = rst!Email
    .Subject = "Testing"
    .Body = "Test number one"
    .Send
    rst.Close
    Set rst = Nothing
    Set db = Nothing
    End With
    End Sub

    I have this code

Posting Permissions

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