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.
 
G

Guest

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="(e-mail address removed)"
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top