SendObject with multiple strTo entries

J

JNariss

If you just read the previous post, this one is different and for a
separate database. I originally posted this in "Getting Started" and
then realized I was in the wrong forum:

Hello,

I have nearly become an expert using the SendObject. However I have now

run into a slight problem. I have this one form that did a fantasic job

of emailing to a group of 4 people. Not 4 ordinary people but 4
"Managers". Well, now it seems that the "Analysts" would like to
receive a notification as well.


So I used to have my send obect set up with:


DoCmd.SendObject acSendNoObject, , ,
"(e-mail address removed),[email protected],[email protected],[email protected]",

, , "Move To Production1", strMessage, No, False


This is not going to work anymore and I can't just throw in the
analyst's name b/c there are a ton of analysts and each time this form
is used it could be a different analyst that it will be sent to.


So I've been using the Dim strTo As String, strTo = syntax to try to
accomplish grabbing the Analyst Email from that field on the form as
well as still emailing to the group of 4 managers. The only problem now

is...............it's not working.


Here is the code I have tried:


Private Sub cmdSubmit_Click()


Dim strRequest_ID As String
Dim strTo As String
Dim strHeader As String
Dim strMessage As String
Dim strAuthorized_By As String


strRequest_ID = Me.Request_Request_ID
strTo = "[Me.Analyst_Email]" &
"[[email protected],[email protected],[email protected],[email protected]]"

strHeader = "Request moved into production"
strMessage = "A request has been officially moved into production.
Details for this move are below." _
& "If this move was incorrect please contact the listed Authorizer
below:" & Chr$(13) & Chr$(13) & _
"Request_ID: " & strRequest_ID & Chr$(13) & Chr$(13) & _
"Authorized By: " & strAuthorized_By & Chr$(13) & Chr$(13) & _
"Please do not respond to this automated email."


DoCmd.SendObject acSendNoObject, , , strTo, , , strHeader,
strMessage, No, False


DoCmd.Close acForm, "frmMoveToProd1"


MsgBox "You have submitted this request into production" &
Chr$(13) & Chr$(13) & _
"and sent notification to management and the assigned
analyst.", vbOKOnly, _
"Move To Production Successful!"


End Sub


I have tried numerous things with the line "strTo = " such as taking
out the [ ] and taking out the " " and leaving it as one like
"Me.Analyst_Email & (e-mail address removed),[email protected]" and i have tried

strTo = Me.Analyst_Email &
"(e-mail address removed),[email protected],[email protected],[email protected]"

but neither of them seem to work.


Is this even possible??????? And if not how can I make it happen or do
something similar to this???


I appreciate it,
Justine
 
R

Rob Oldfield

You're close with:

strTo = Me.Analyst_Email &
"(e-mail address removed),[email protected],[email protected],[email protected]"

but it will be missing the separator character after the analyst email.
Try:

strTo = Me.Analyst_Email &
",[email protected],[email protected],[email protected],[email protected]"

One other thing. You shouldn't really use commas to separate the addresses.
It only works because (I think) it's set as the default number separator in
your regional settings. Use ;s instead:

strTo = Me.Analyst_Email &
";[email protected];[email protected];[email protected];[email protected]"



If you just read the previous post, this one is different and for a
separate database. I originally posted this in "Getting Started" and
then realized I was in the wrong forum:

Hello,

I have nearly become an expert using the SendObject. However I have now

run into a slight problem. I have this one form that did a fantasic job

of emailing to a group of 4 people. Not 4 ordinary people but 4
"Managers". Well, now it seems that the "Analysts" would like to
receive a notification as well.


So I used to have my send obect set up with:


DoCmd.SendObject acSendNoObject, , ,
"(e-mail address removed),[email protected],[email protected],[email protected]",

, , "Move To Production1", strMessage, No, False


This is not going to work anymore and I can't just throw in the
analyst's name b/c there are a ton of analysts and each time this form
is used it could be a different analyst that it will be sent to.


So I've been using the Dim strTo As String, strTo = syntax to try to
accomplish grabbing the Analyst Email from that field on the form as
well as still emailing to the group of 4 managers. The only problem now

is...............it's not working.


Here is the code I have tried:


Private Sub cmdSubmit_Click()


Dim strRequest_ID As String
Dim strTo As String
Dim strHeader As String
Dim strMessage As String
Dim strAuthorized_By As String


strRequest_ID = Me.Request_Request_ID
strTo = "[Me.Analyst_Email]" &
"[[email protected],[email protected],[email protected],do......@eg
seg.com]"

strHeader = "Request moved into production"
strMessage = "A request has been officially moved into production.
Details for this move are below." _
& "If this move was incorrect please contact the listed Authorizer
below:" & Chr$(13) & Chr$(13) & _
"Request_ID: " & strRequest_ID & Chr$(13) & Chr$(13) & _
"Authorized By: " & strAuthorized_By & Chr$(13) & Chr$(13) & _
"Please do not respond to this automated email."


DoCmd.SendObject acSendNoObject, , , strTo, , , strHeader,
strMessage, No, False


DoCmd.Close acForm, "frmMoveToProd1"


MsgBox "You have submitted this request into production" &
Chr$(13) & Chr$(13) & _
"and sent notification to management and the assigned
analyst.", vbOKOnly, _
"Move To Production Successful!"


End Sub


I have tried numerous things with the line "strTo = " such as taking
out the [ ] and taking out the " " and leaving it as one like
"Me.Analyst_Email & (e-mail address removed),[email protected]" and i have tried

strTo = Me.Analyst_Email &
"(e-mail address removed),[email protected],[email protected],[email protected]"

but neither of them seem to work.


Is this even possible??????? And if not how can I make it happen or do
something similar to this???


I appreciate it,
Justine
 

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

Top