I have the following code that gets data from a query then will send an email to roughly 150 people. I want them to reply and verify the information that I have in the database.
What I would like is for them to respond easily. I was wondering if it was possible to put 2 buttons in the body of the email? one button that replies to the message with text that says "all information is complete and valid", and a second button that would essentially just click reply - then they could just respond whatever way they wanted. I'm thinking most will hit the "All is OK" button, so I would like that as automated as possible so I'm not waiting forever for people to respond.
Or is there some easier way that I'm missing. And/or is it even possible to put that kind of button in an outlook email?
here's the code I have:
Private Sub cmdSendEmail_Click()
Dim objOutlook As Object
Dim objMailItem As Object
Dim strSubject As String
Dim strFrom As String
Dim strBody As String
Dim intJV As Integer
Dim rstEmail As DAO.Recordset
'LOOP THROUGH A RECORDSET TO SEND AN EMAIL TO EACH RECORD
Set rstEmail = CurrentDb.OpenRecordset("qryEmailRegistration")
rstEmail.MoveLast
rstEmail.MoveFirst
intJV = 0
For intJV = 0 To rstEmail.RecordCount - 1
'EMAIL FROM HERE
strFrom = """School Records ""<recordsupdate@school.com>"
'EMAIL SUBJECT HERE
strSubject = "School Information Verification"
'EMAIL BODY HERE
strBody = "To The " & rstEmail!FamilyLastName & " Family:" & vbCrLf & vbCrLf & "As you may know, the school has implemented a new school database." _
& " This database will aid in automating the school directory, school mailings, the One Call Now™ system, and various other reports and office records containing the student and family information." _
& vbCrLf & vbCrLf & "It is important that the information be accurate, so we ask that you please verify the details below that are currently in the database. Please reply to this email with any changes/updates." _
& vbCrLf & vbCrLf & "Thank you." & vbCrLf & vbCrLf & "Please respond to this email ASAP. " _
& vbNewLine & "* * * * * * * * * * * * * * * * * * * *" _
& vbNewLine & "Information on file for the " & rstEmail!FamilyLastName & " Family..." & vbCrLf & vbCrLf & vbTab & "Primary Address: " & rstEmail!FamilyStreetAddress & " " & rstEmail!FamilyCity & ", " & rstEmail!FamilyZipcode & vbCrLf & vbCrLf & vbTab & "Primary Phone Number: " _
& vbTab & rstEmail!PrimaryTelephone & vbCrLf & vbCrLf & vbTab & "Mother's Name: " & rstEmail!MotherFirstName & vbCrLf & vbCrLf & vbTab & "Mother's Work Phone: " & rstEmail!MotherWorkNo & vbCrLf & vbCrLf & vbTab & "Mother's Cell: " _
& rstEmail!MotherCellNo & vbCrLf & vbCrLf & vbTab & "Mother Additional eMail: " & rstEmail!MotherEMail2 & vbCrLf & vbCrLf & vbTab & "Father's Name: " & rstEmail!FatherFirstName & vbCrLf & vbCrLf & vbTab & "Father's Work: " _
& rstEmail!FatherWorkNo & vbCrLf & vbCrLf & vbTab & "Father's Cell: " & rstEmail!FatherCellNo & vbCrLf & vbCrLf & vbTab & "Father Additional eMail: " & rstEmail!FatherEMail2 _
& vbNewLine & vbNewLine & "* * * * * * * * * * * * * * * * * * * *" _
& vbNewLine & "Your Primary Address and Primary Telephone Number ONLY will be published in the directory. Please let me know if you do not want your information listed." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & Chr(13) & Chr(10)
Set objOutlook = CreateObject("Outlook.application")
Set objMailItem = objOutlook.CreateItem(0)
With objMailItem
.To = rstEmail!MotherEMail
.SentOnBehalfOfName = strFrom
.SUBJECT = strSubject
.Importance = 2
.Body = strBody
.Display
SendKeys "%{s}", True
End With
Set objMailItem = Nothing
Set objOutlook = Nothing
rstEmail.MoveNext
Next intJV
End Sub
Thank you!!
What I would like is for them to respond easily. I was wondering if it was possible to put 2 buttons in the body of the email? one button that replies to the message with text that says "all information is complete and valid", and a second button that would essentially just click reply - then they could just respond whatever way they wanted. I'm thinking most will hit the "All is OK" button, so I would like that as automated as possible so I'm not waiting forever for people to respond.
Or is there some easier way that I'm missing. And/or is it even possible to put that kind of button in an outlook email?
here's the code I have:
Private Sub cmdSendEmail_Click()
Dim objOutlook As Object
Dim objMailItem As Object
Dim strSubject As String
Dim strFrom As String
Dim strBody As String
Dim intJV As Integer
Dim rstEmail As DAO.Recordset
'LOOP THROUGH A RECORDSET TO SEND AN EMAIL TO EACH RECORD
Set rstEmail = CurrentDb.OpenRecordset("qryEmailRegistration")
rstEmail.MoveLast
rstEmail.MoveFirst
intJV = 0
For intJV = 0 To rstEmail.RecordCount - 1
'EMAIL FROM HERE
strFrom = """School Records ""<recordsupdate@school.com>"
'EMAIL SUBJECT HERE
strSubject = "School Information Verification"
'EMAIL BODY HERE
strBody = "To The " & rstEmail!FamilyLastName & " Family:" & vbCrLf & vbCrLf & "As you may know, the school has implemented a new school database." _
& " This database will aid in automating the school directory, school mailings, the One Call Now™ system, and various other reports and office records containing the student and family information." _
& vbCrLf & vbCrLf & "It is important that the information be accurate, so we ask that you please verify the details below that are currently in the database. Please reply to this email with any changes/updates." _
& vbCrLf & vbCrLf & "Thank you." & vbCrLf & vbCrLf & "Please respond to this email ASAP. " _
& vbNewLine & "* * * * * * * * * * * * * * * * * * * *" _
& vbNewLine & "Information on file for the " & rstEmail!FamilyLastName & " Family..." & vbCrLf & vbCrLf & vbTab & "Primary Address: " & rstEmail!FamilyStreetAddress & " " & rstEmail!FamilyCity & ", " & rstEmail!FamilyZipcode & vbCrLf & vbCrLf & vbTab & "Primary Phone Number: " _
& vbTab & rstEmail!PrimaryTelephone & vbCrLf & vbCrLf & vbTab & "Mother's Name: " & rstEmail!MotherFirstName & vbCrLf & vbCrLf & vbTab & "Mother's Work Phone: " & rstEmail!MotherWorkNo & vbCrLf & vbCrLf & vbTab & "Mother's Cell: " _
& rstEmail!MotherCellNo & vbCrLf & vbCrLf & vbTab & "Mother Additional eMail: " & rstEmail!MotherEMail2 & vbCrLf & vbCrLf & vbTab & "Father's Name: " & rstEmail!FatherFirstName & vbCrLf & vbCrLf & vbTab & "Father's Work: " _
& rstEmail!FatherWorkNo & vbCrLf & vbCrLf & vbTab & "Father's Cell: " & rstEmail!FatherCellNo & vbCrLf & vbCrLf & vbTab & "Father Additional eMail: " & rstEmail!FatherEMail2 _
& vbNewLine & vbNewLine & "* * * * * * * * * * * * * * * * * * * *" _
& vbNewLine & "Your Primary Address and Primary Telephone Number ONLY will be published in the directory. Please let me know if you do not want your information listed." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & Chr(13) & Chr(10)
Set objOutlook = CreateObject("Outlook.application")
Set objMailItem = objOutlook.CreateItem(0)
With objMailItem
.To = rstEmail!MotherEMail
.SentOnBehalfOfName = strFrom
.SUBJECT = strSubject
.Importance = 2
.Body = strBody
.Display
SendKeys "%{s}", True
End With
Set objMailItem = Nothing
Set objOutlook = Nothing
rstEmail.MoveNext
Next intJV
End Sub
Thank you!!