Sending Email from Form

D

Doug_C

Hello,

I was wondering if there is a way to format the information sent in a email
from an Access Form.

Example:

Here is the code I am using which I obtained from this Forum:

Dim SendTo As String, MySubject As String, MyMessage As String
SendTo = "[email protected]"
MySubject = "Issue"
MyMessage = Me.LoanNumber & " " & Me.ErrorCode & " " & Me.Comments
DoCmd.SendObject acSendNoObject, , , SendTo, , , MySubject, MyMessage, True

The works great and will do the job. However, is there a way to format on
the email like this:

Loan Number:
Error Code:
Comments:

Right now it doesn't show the field names and enters it in a sentence.
Again, this will work but I was trying to make it look more organized for the
users.

Thanks!!!!
 
J

jmonty

Use the following instead of vbCR or vbCRLF in order to insert Carriage
returns:
%0D%0A
So,
MyMessage = Me.LoanNumber & "%0D%0A" & Me.ErrorCode & _
"%0D%0A" & Me.Comments

LOL

jmonty
 
D

Doug_C

Hi jmonty,

It doesn't work. When I insert it into the code, it show in the memo but not
on the next line.

Thank you away for your response!!
 
J

jmonty

Looks like I am using a different method to send email.

Maybe try using the vbCr or Chr(13) instead:

MyMessage = Me.LoanNumber & vbCr & Me.ErrorCode & _
vbCr & Me.Comments
or
MyMessage = Me.LoanNumber & vbCrLF & Me.ErrorCode & _
vbCrLF & Me.Comments
or
MyMessage = Me.LoanNumber & Chr(13) & Me.ErrorCode & _
Chr(13) & Me.Comments



jmonty
 
D

Doug_C

The first one works!! I didn't try the other two. Thank you very much for
following up and giving a helping hand! The message looks much cleaner now.

Thanks again, you're help was most appreciated!
 
J

jmonty

I am very glad I could help!

jmonty


Doug_C said:
The first one works!! I didn't try the other two. Thank you very much for
following up and giving a helping hand! The message looks much cleaner now.

Thanks again, you're help was most appreciated!
 
Top