PDA

View Full Version : Can a checkbox located on a form in Access open a new email when selected?



junglej815
04-17-2014, 08:06 AM
Hello,

Does anyone know if it is possible to have a new email window open when a checkbox is selected?

Thanks,
Joe

SoftwareMatt
04-24-2014, 05:58 AM
Yes, just add some VBA to the AfterUpdate event. Something like this:



Dim oApp As Object, oMessage As MailItem, oRec As Recipient
Set oApp = CreateObject("Outlook.Application")
Set oMessage = oApp.CreateItem(olMailItem)
oMessage.Display ‘comment out if you need to send straight to outbox
oMessage.Recipients.Add(“EMAIL ADDRESS HERE”).Type = olTo
oMessage.Subject = “SUBJECT TEXT HERE”
oMessage.Body = “BODY TEXT HERE”
‘oMessage.Send ‘uncomment this line if you want to send straight to the outbox
Set oApp = Nothing