DoCmd Code

  • Thread starter Thread starter Stan
  • Start date Start date
S

Stan

I'm wanting to insert data, in this case and employee's name from query1,
into the text of an email. Can anyone tell me how this is done. I've
provide some sample code below. Many thanks!

Function SendEmail()

DoCmd.SendObject acSendQuery, "Query1", "HTML", "John Doe", , , "Adherence", _
"The following agent (Query1.[Employee Name]) is out of adherence"

End Function
 
Check out the DLookup function, it may provide the results that you seek.

DoCmd.SendObject acSendQuery, "Query1", "HTML", "John Doe", , , "Adherence",
_
"The following agent (" & DLookup("Employee Name", "Query1") & ") is out of
adherence"
 
Back
Top