Customized Email

S

serviceenvoy

I need to set up a double click event that will create a new email and
include certain fields from the record I'm currently in and use the
email address from another table/form (the 2 tables/forms are linked
by an ID#). I also want it to include a generic message in the body
of each email (like a signature). How do I do that?
 
C

CompGeek78

I need to set up a double click event that will create a new email and
include certain fields from the record I'm currently in and use the
email address from another table/form (the 2 tables/forms are linked
by an ID#). I also want it to include a generic message in the body
of each email (like a signature). How do I do that?

Without further information, probably the easiest way to accomplish
this is the docmd.sendobject method.

Something along these lines:

DoCmd.SendObject acSendNoObject, , , FieldWithToAddress,
FieldWithCCAddress, FieldWithBCCAddress, FieldWithSubject,
FieldWithMessage & "text to be added to all emails", False
 
A

Arvin Meyer [MVP]

I need to set up a double click event that will create a new email and
include certain fields from the record I'm currently in and use the
email address from another table/form (the 2 tables/forms are linked
by an ID#). I also want it to include a generic message in the body
of each email (like a signature). How do I do that?

Try something like:

Public Function EmailReps(strTo As String, Optional strSubject _
As String, Optional strMsg As String)
'Set reference to Outlook
On Error GoTo Errhandler
Dim objOutl As Outlook.Application
Dim objEml As Outlook.mailitem

Set objOutl = CreateObject("Outlook.application")
Set objEml = objOutl.createItem(olMailitem)

With objEml
.To = strTo
.Subject = strSubject
.Body = strMsg
.send
End With

ExitHere:
Set objOutl = Nothing
Exit Function

Errhandler:
MsgBox Err.Number & ": " & Err.Description
Resume ExitHere
End Function


Now call it like this:

Public Function MailIt()
Dim strSubject As String
Dim strMsg As String
Dim strTo As String

Select Case Me.txtSub
Case "AC"
strTo = "Ashley Cove;Change History"
Case "AR"
strTo = "Arbor Ridge;Change History"
Else
strTo = "Change History"
End Select

strSubject = "Contract Changes to [" & Me.txtSub & " - " & Me.txtLot &
" - " & Me.txtBuyer & "] By: " & Me.txtUser

strMsg = Me.txtContractID & ",," & """" & Format(Now, "mm/dd/yy h:nn
AM/PM") & """"

Call EmailReps(strTo, strSubject, strMsg)
Me.chkMailFlag = False
End Function

Notice how strSubject and strMsg are using form data in the subject and body
of the email.
 

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