Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email BodyFormat in Html 1

Status
Not open for further replies.

houstonbill

Technical User
Nov 6, 2006
92
I have spent that last 2 hours looking at posts and other Access/VBA sources to try and figure out how to format the body of my email generated by a button in HTML format. I was looking at thread 705-1150127 which made the most sense of everything I looked at but I was still confused by where this "MailItem" property is, and thereby theBodyFormat I have tried a few different things without any luck. This is not an area I am familiar with.

I am hoping someone can assist me based on the code I have below and maybe then it will make more sense:

Private Sub btnEmail_Click()
On Error GoTo Err_btnEmail_Click


Dim stWhere As String '-- Criteria for DLookup
Dim varTo As Variant '-- Address for SendObject
Dim stText As String '-- E-mail text
Dim RecDate As Variant '-- Rec date for e-mail text
Dim stSubject As String '-- Subject line of e-mail
Dim stWho As String '-- Reference to tblUsers
Dim stDept As String '-- Department who assigned ticket
Dim stOrderID As String '-- Work Order Number
Dim stCorpDte As String '-- CorpRecv Date of Project
Dim stRequester As String '-- Person Requesting
Dim stProvName As String '-- Prov Office Requesting
Dim stWorkOrderName As String '-- Name Given to Work Order

'This forces the record to be saved.

If Me.Dirty Then
Me.Dirty = False
End If


'-- Combo of names to assign price change to
stWho = Me.cboGroup
stWhere = "ClientServices_tbl.GroupID = " & "'" & stWho & "'"


'-- Looks up email addresses from ClientServices_tbl
varTo = DLookup("[ClientEMAIL]", "ClientServices_tbl", stWhere)

RecDate = Me.CurrDte


stSubject = ":: New Work Order Request Submitted :: " & OrderID & Space(5) & ProvName & Space(5) & WorkOrderName

stOrderID = Format(Me.ID, "00000")
stProvName = Format(Me.ProvName)
stWorkOrderName = Format(Me.WorkOrderName)



'-- Evaluators employee who assigns ticket
stCorpDte = Me.CmpyRecvDte
stDept = Me.cboDepartment
stRequester = Me.ReqName

stText = "A new work order request has been submitted. Complete details can be located under the work order number on the database." & Chr$(13) & Chr$(13) & _
"Work Order Number: " & stOrderID & Chr$(13) & _
"Corporate received date: " & stCorpDte & Chr$(13) & _
"Requested by: " & stDept & Chr$(13) & _
"Sent by: " & stRequester & Chr$(13) & _
"This is an automated message. Please do not respond to this e-mail."


'Write the e-mail content for sending to assignee
DoCmd.SendObject , , acFormatHTML, varTo, , , stSubject, stText, -1
DoCmd.GoToRecord , , acNewRec
Exit_btnEmail_Click:
Exit Sub

Err_btnEmail_Click:
MsgBox Err.Description
Resume Exit_btnEmail_Click
End Sub
 
Have you tried to replace Chr$(13) with "<BR>" ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I had not tried that but in doing so, it does not seem to work. I get a snytax error with the stText in Red. Thanks for the try.
 
Here is what is highlighted as in error:

stText = "A new work order request has been submitted. Complete details can be located under the work order number on the database." & <BR> & <BR> & _
"Work Order Number: " & stOrderID & <BR> & _
"Corporate received date: " & stCorpDte & <BR> & _
"Requested by: " & stDept & <BR> & _
"Sent by: " & stRequester & <BR> & _
"This is an automated message. Please do not respond to this e-mail.
 
I've suggested this instead:
stText = "A new work order request has been submitted. Complete details can be located under the work order number on the database." & [!]"[/!]<BR>[!]"[/!] & [!]"[/!]<BR>[!]"[/!] & _

You may simplify like this:
stText = "A new work order request has been submitted. Complete details can be located under the work order number on the database.<BR><BR>" & _

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
This does help, and thanks for your assistance. I will work with your suggestion on this as well as another database that I have. It sets me on the right path.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top