Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass an ID field to the subject line of an email 1

Status
Not open for further replies.

Caryisms

Technical User
Oct 17, 2001
132
US
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.

 
How are you sending the e-mail?

SendObjects or are you using the Outlook object model?

Post the code and I can tell you where to insert the info for your subject line.

Kyle
 
Kyle,

Please see below. Thank you.


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, txtMessage, False
rs.MoveNext
Loop Until rs.EOF
rs.Close
db.Close

End Sub
 
Hi Caryisms,

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.


Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top