I have an access database and from the form I want an email to trigger if the DaysLeft box is less than 5 and the MoveOutPacket box is empty
I have this code but it is not emailing Private Sub DaysLeft_Change()
Any Suggestions?
Private Sub DaysLeft_Change()
If (DaysLeft < 5) And (MoveOutPacket = Null) Then
Dim Msg As String
Msg = “Maintenance Team, we will recieve the keys for ” & Property & ” on ” & Recieved_Keys & ” please schedule cleaning and carpet cleaning if the unit is vacant.”
Dim O As Outlook.Application
Dim M As Outlook.MailItem
Set O = New Outlook.Application
Set M = O.CreateItem(olMailItem)
With M
.BodyFormat = olFormatHTML
.HTMLBody = Msg
.To = "[email protected]"
.Send
End With
Set M = Nothing
Set O = Nothing
End If
End Sub
Hannah Bruno is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.