Send email with MS Access

We have an access database that lets our floor employees click a button to send reports and data to the supervisor. I know that Access is probably a bad word here but it works for us in this environement and makes the data pretty much error proof.

Anyway I’m using some code that a forum user posted but I’ve run into a snag. Part of the code is listed below. It works fine but the body of the text is where we are having a problem. I need to add lines to format the body and it’s not working the way I expected.

Our body string is formated like:

strBody= "Order " & OrderNumber & “is ready” & vbcrlf & "There were " & FootageRun & “feet run for this order”

The vbCRLF does not actually insert a CR and LF so all the text is run together on one line. Is there a way to format this correctly?

Thanks

David

With mailDoc

.AppendItemValue(“Form”,“Memo”)

.AppendItemValue(“SendTo”,<addressees As String, String Array or Variant>)

.AppendItemValue(“CopyTo”,)

.AppendItemValue(“BlindCopyTo”,)

.AppendItemValue(“Subject”,“Subject As String”)

End With

body = mailDoc.CreateRichTextItem(“Body”)

body.AppendText strBody

Subject: Send email with MS Access

(Chr(13) + Chr(10)) = vbCRLF. Put this in your code : (Chr(13) + Chr(10))

HTH,

SPJ

Subject: RE: Send email with MS Access

I tried that and got the same results.

David

Subject: Send email with MS Access

You could, I know this sounds ridiculous, but do a break-down of your values and put a newline (addnewline) between your values. :frowning: I just tried your code and it workes fine with the (Chr(13) + Chr(10)).

'Decs section

Const vbcrlf = (Chr(13) + Chr(10))

'Rest of code

strBody= "Order " & OrderNumber & “is ready” & vbcrlf & "There were " & FootageRun & “feet run for this order”

Subject: RE: Send email with MS Access

Are you using OLE or COM? Under the OLE it works but under COM it doesn’t. If I use OLE when it opens notes there is only one tab showing and has a few ascii characters.

We wanted to use COM because this way our operators never see Notes open or have to interface with it.

David

Subject: RE: Send email with MS Access

Body is Rich Text. Use AppendText(String) to add text and AddNewline(numberOfReturns) to create new paragraphs.