Adding other email address to the DoCmd.SendOject

  • Thread starter Thread starter Chi
  • Start date Start date
C

Chi

Hi,

The DoCmd.SendObject below works fine. Would you please show me how I can
add another email address to it. Ex: (e-mail address removed).



Private Sub EmailRequest_Click()
DoCmd.SendObject _
, _
, _
, _
"(e-mail address removed)", _
, _
, _
"Secretary Request No. ", _
"If you could take a look at this, deeply appreciate it! THX!" &
vbCrLf & " ", _
True
DoCmd.Close
End Sub
 
Nothing could be simpler. If you look at the help file you see they specify:
" Separate the recipient names you specify in this argument and in the cc
and bcc arguments with a semicolon (;)"

So try something like
....
"(e-mail address removed);[email protected]",
....

--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
Hi Daniel,

Thank you for the quick response! After using the "; " to add the another
email adress to the DoCmd.SendOject, I can sent to both!!. I understand that
everything is not simple. Moreover, I don't have back ground in coding.
Therefore everthing is harder...

Would you please.. please help me if I want to sent email for either one.
Ex: I would like to sent email to Sue only.

Thanks
Chi
 
Hi Daniel,

I would like to let you know that I didn't create the DoCmd. SendOject.
Someone else do it. The original coding has two email addresses in the
argument, but I took one out. I remember that the other email address located
above the current one. I took it out and now I don't know how to put it
back since I did it for a few months ago.
I always get error messages since I don’t know anything about coding. sorry.
Thank you so much
Chi
 
I('m not sure if I understood the question properly. If your want to have a
routine the selectively send an e-mail to one individual or another based on
a criteria you'd need to create an if statement

***********
Dim sSubject As String
Dim sMessage As String
Dim sRecipient As String

If YourCriteria Then
sRecipient = "(e-mail address removed)"
Else
sRecipient = "(e-mail address removed)"
End If

sSubject = "Secretary Request No. "
sMessage = "If you could take a look at this, deeply appreciate it!
THX!" & vbCrLf & " "

DoCmd.SendObject , , , sRecipient, , , sSubject, sMessage, True
DoCmd.Close
*********

You could also send each e-mail message separatly, ie:

*********
Dim sSubject As String
Dim sMessage As String

sSubject = "Secretary Request No. "
sMessage = "If you could take a look at this, deeply appreciate it!
THX!" & vbCrLf & " "

DoCmd.SendObject , , , "(e-mail address removed)", , , sSubject, sMessage,
True
DoCmd.SendObject , , , "(e-mail address removed)", , , sSubject, sMessage, True
DoCmd.Close
*********

If this isn't what you need, please explain more and I'm sure I can help you
out.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
Good Moring Daniel,

Thank you so so much for your help!! I tried both ways!

I would like to work with the first method - Use if then else. However,
I don't know what the criteria is and the (sMessage = "If you could take a
look at this, deeply appreciate it! THX!" & vbCrLf & " ") is not correct. It
turned red when I used them.

I would like to explain more about my work:

The users enter information to the REQUEST Form that has Instructor name,
Requested to and Project title fields. The users can pick the name listed in
the drop out list. Ex: they can choose Sue or Oanh who are going to help them.

Before hitting the Sending Request button which has the SentObjet action,
they must select the tree fields: Instructor name, Requested to and Project
title fields.

Ex: if they choose "Sue" from the REQUESTED TO's drop out list, the email
will sent to SUE only, not both "SUE and OANH" .

I think that the criteria should be "the name selected on the REQUESTED TO
list", but I don't know what to replace "your criteria†in the codes you gave
to me.


I am very appreciated for all your help!
Chi
 
There was word-wrap in Daniel's response. The line of text you quote should
be a single line.
 
Hi Daniel,

I tried working with your codes. I think that it works since after clicking
the Send button, the outlook is opened. However, It didn't either add chi's
email nor Sue's email in it. Therefore, I continue working on the "criteria"
to put in the If statement.

Here is my work:
The table has the field named "RequestedTo" stored the names like Chi and
Sue that use for the drop out list on the form. When users choose Chi and hit
the Send button, the outlook will be open and add the Chi's email address in
there.

I tried to add Dim RequestedTo as String to the code and the "criteria" is
RequestedTo = "chi"

So the final codes will be:

Dim sSubject As String
Dim sMessage As String
Dim sRecipient As String
Dim Requested To As String
If RequestedTo="chi" Then
sRecipient = "(e-mail address removed)" Else
sRecipient = "(e-mail address removed)"
End If

sSubject = "Secretary Request No. "
sMessage = "If you could take a look at this, deeply appreciate it!
THX!" & vbCrLf & " "

DoCmd.SendObject , , , sRecipient, , , sSubject, sMessage, True
DoCmd.Close

-------
Please take a look at the codes and let me know what do you think?


Please help!
Thanks
Chi
Thanks
Chi
 
Back
Top