Mail Message

A

Allen Thompson

I have some code I have adapted from one of the posts. I am trying to take a
record from a table which includes email address, project number, project
name, etc.. I have figured out how to fill in the TO: Line and part of the
message.

I need to include information from the record in the table in the email.

CODE:
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click

Dim strDocName As String
Dim strEmail As String
Dim strMailSubject As String
Dim strMsg As String

strDocName = Me.lstRpt
strEmail = Me.txtSelected & vbNullString
strMailSubject = "Segment Research & Analytics"
strMsg = Me.txtMsg & vbNullString & vbCrLf & _
vbNullString & vbCrLf & _
vbCrLf & "Recently the research and Analytics group completed a project
for you. The project ID & Name are below:" & _

XXXXXXXXXXXXXXXXXXXXXXXX

vbNullString & vbCrLf & _
vbNullString & vbCrLf & _
vbCrLf & "Allen J Thompson" & _
vbCrLf & "Mail To: Allen_J_Thompson@***.Com" & _
vbCrLf & "Phone: (***)*******"


DoCmd.SendObject objecttype:=acSendNoObject, _
ObjectName:=strDocName, outputformat:=acFormatHTML, _
To:=strEmail, Subject:=strMailSubject, MessageText:=strMsg

This is what I want it to look like - all the text is static except for the
information XXXXXX which would come from the table:

Recently the Segment Research & Analytics group completed a project for you.
The project ID & Name are below:

"3258" "PR & CD1 Messaging Drivers Study"

If you could either click on the link below or copy and paste the link into
a browser window a short survey will be displayed. This survey is designed
for us to better assist you with your research and analytic needs. If at all
possible please complete the survey by Friday 06/25/04.

http://********08.ma.***.com/forms/html/copy_of_copy_of_bus_partner_survey2.htm

Thank you in advance for your participation.



Any help would be much appreciated.

Thank you - Allen
 
V

Van T. Dinh

There are a few methods but the simplest one is to use the DLookUp()
function.

Check Access Help on DLookUp.
 
V

Van T. Dinh

Add where you want it. I added it where I think you want in your post.

strMsg = Me.txtMsg & _
vbCrLf & "Recently the research and Analytics group completed a project
for you. The project ID & Name are below:" & _
vbNullString & vbCrLf & _
vbCrLf & "If you could either click on the link below or copy and paste
the link into a browser window a short survey will be displayed." & _
DLookup("[ID]", "EMAIL TEST TABLE") & vbNullString & vbCrLf & _
vbCrLf & "This survey is both part of our Hoshin Metrics and is also
designed for us to better assist you with your research and analytic needs.
If at all possible please complete the survey by Friday 06/25/04." & _
vbNullString & vbCrLf & _
vbCrLf & "http://forms/html/copy_of_copy_of_bus_partner_survey2.htm" & _
vbNullString & vbCrLf & _
vbCrLf & "Thank you in advance for your participation." & _
vbNullString & vbCrLf & _
vbCrLf & "Allen J Thompson" & _
vbCrLf & "Mail To: (e-mail address removed)" & _
vbCrLf & "Phone: XXX XXX-1393"


You don't need to declare and use varX.

I am not sure why you use a number of vbNullString in your concatenation.
AFAIK, vbNullString doesn't do anything inyour concatenation.
 

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