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