Sending Email from MS Access 2010 (1 Viewer)

Valery

Registered User.
Local time
Yesterday, 18:16
Joined
Jun 22, 2013
Messages
363
Hi there,

I would like to update the following code I have been using to send emails, from Access 2010 via Outlook 2010, to include my signature block with hard returns in between each line and a few above the signature.

Lets say the signature would be:
My Name
My Company Name
My phone number
My Reference

I tried next to: stMessage = Me![EmailMessage] &"My Name" & Chr(10) & Chr(13) & "My Company Name"

etc.

It does not work... Help! Please! TYTY

Here is the coding :

Code:
Private Sub SendEmail_Click()
On Error GoTo ProcErr
    Dim stLinkCriteria As String
    Dim stSubject As String
    Dim stMessage As String
    
stLinkCriteria = Me![Email]
stSubject = Me![EmailSubject]
stMessage = Me![EmailMessage]
DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , , stSubject, stMessage
ProcExit:
Exit Sub
ProcErr:
If Err.Number = 2501 Then
    GoTo ProcExit
End If
MsgBox "Error#" & Err.Number & "." & Err.Description & "- SendEmail_Click"
    Resume ProcExit
End Sub
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:16
Joined
Aug 30, 2003
Messages
36,129
Try

stMessage = Me![EmailMessage] & vbCrLf & "My Name" & vbCrLf & "My Company Name"
 

Valery

Registered User.
Local time
Yesterday, 18:16
Joined
Jun 22, 2013
Messages
363
This works great! I also would like to add say three hard returns before "My Name" and 1 hard return before the last line. I tried :

& vbCrLf & vbCrLf & and also tried: & vbCrLf vbCrLf &

but no success :(
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:16
Joined
Aug 30, 2003
Messages
36,129
Looks like you were on the right track. Each needs to be concatenated, like:

stMessage = Me![EmailMessage] & vbCrLf & vbCrLf & vbCrLf & "My Name" & vbCrLf & "My Company Name"
 

Valery

Registered User.
Local time
Yesterday, 18:16
Joined
Jun 22, 2013
Messages
363
Works great - I don't get it - I could swear that's exactly one of the ways I had done it... but it was all coming out red with error messages! It's fine now!

Thank you for such an excellent, to the point and sure quick answers!
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:16
Joined
Aug 30, 2003
Messages
36,129
Happy to help!
 

Users who are viewing this thread

Top Bottom