I have automated the sending of email to many customers, and I need to put an id field in the subject line of each email. The id field is in the table and query I am running the function from. Please help. Thank you.
Try this:
Private Sub cmdSend_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim txtTO, txtCC, txtBCC, txtSubject, txtMessage As String
txtTO = ""
txtCC = ""
txtBCC = ""
txtSubject = "Request Now!"
txtMessage = "July 03, 2003" _
Set db = CurrentDb
Set rs = db.OpenRecordset("TEST", dbOpenDynaset)
rs.MoveFirst
Do
gblvID = rs("ID"
txtTO = rs("EmailAddress"
DoCmd.SendObject acSendReport, "Request Form TEST", acFormatRTF, txtTO, txtCC, txtBCC, txtSubject & " - " & rs!ID , txtMessage, False
rs.MoveNext
Loop Until rs.EOF
rs.Close
db.Close
End Sub
The italicized part is what I added. Since youve already got a subject line in there, all you should have to do is simply concantenate the ID on the end of it like above.
If I'm misunderstanding what you're trying to do, please let me know.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.