Send Email Form Access

S

Samuel

Currently I use the following method to send emails:

Dim stDocName As String

stDocName = "rptCurrentClientsStartDateEmail"
DoCmd.SendObject acReport, stDocName


But how can I specify fields within the email like Subject , To, etc.?

Thank you,
Samuel
 
R

Rick Brandt

Samuel said:
Currently I use the following method to send emails:

Dim stDocName As String

stDocName = "rptCurrentClientsStartDateEmail"
DoCmd.SendObject acReport, stDocName


But how can I specify fields within the email like Subject , To, etc.?

Thank you,
Samuel

Check Help on the SendObject method. It has arguments for all of those.
You just aren't using them.
 
D

Daniel

As Rick mentioned, by looking at the sendobject method in the help file
you'll see that its synthax is as follows

expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc,
Subject, MessageText, EditMessage, TemplateFile)

Thus you need only provide the proper input variable with info.

stDocName = "rptCurrentClientsStartDateEmail"
strTo="[email protected]"
strSubject="This is the E-mail subject"
strBody="This is the E-mail body content"

DoCmd.SendObject acReport, stDocName,,strTo,,,strSubject,strBody
--
Hope this helps,

Daniel P
 
Top