Pull field into email

S

stockwell43

Hello,

I am having some trouble with this code. It works fine but my manager wants
the project name to show in the email. The button is on the form and when she
clicks it the Lead Project person and subject appear. How do I get the
project name to pull as well?

Here is the code:

Private Sub cmdEmail_Click()
On Error GoTo EH
Dim strDeveloper As String

strDeveloper = Me.AssignedTo & ""
If strDeveloper <> vbNullString Then
DoCmd.SendObject acSendNoObject, , , strDeveloper, , , "Project
Message", ""
MsgBox "E-Mail message has been sent to " & strDeveloper & ".",
vbInformation, "E-Mail Sent"
Else
MsgBox "Please designate a LC project lead. ", vbInformation,
"Project Lead Missing"
End If
Exit Sub

EH:
If Err.Number = 2501 Then
MsgBox "This email message has not been sent. Message has been
cancelled."
End If
End Sub

Thanks!!!!
 
S

stockwell43

Ok, I revised the code but now for somereason I cannot get the cursor to
start After the ProjectName. It start at the beginning of the ProjectName.

Here is the new code:

Private Sub cmdEmail_Click()
On Error GoTo EH
Dim SendTo As String, SendCC As String, MySubject As String, MyMessage
As String
SendTo = Me.AssignedTo

MySubject = "Project Information"
MyMessage = Me.ProjectName & vbCr
DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, SendBCC, MySubject,
MyMessage, True

EH:
If Err.Number = 2501 Then
MsgBox "This email message has not been sent. Message has been
cancelled."
End If
End Sub

Thanks!!!
 

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

Similar Threads

Send email from access form 3
Bold Code 2
Email Help 17
email as a pdf 1
2003 - 2007 VBA issue 6
Error message 2293 - Access could not send this email 1
email with subject line 1
How to CC in an email 9

Top