bolo said:
OK, here it is, such as it is....
There are 4 teams of folks that may or may not be notified of a specific
event.. plus there is some special handling hard coded for some specific
events.
the single quote method has worked well thus far..
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Private Sub email_si_Click()
DoCmd.SetWarnings False
On Error GoTo com147err
Dim SI_Subject As String
Dim SI_Message As String
Dim SI_To As String
Dim SI_CC As String
Dim SI_BCC As String
Dim SI_SrMgr As String
Dim SI_SrMgrAlways As String
Dim TempSub As String
Dim TempKey As String
Dim strR1 As String
Dim strETDFail As String
Me.Refresh
' etd failures
strETDFail = "'xxxxxxxxxxxxx1; 'xxxxxxxxxxxxxx2; 'xxxxxxxxxxxxx3;
'xxxxxxxxxxxxx4;
'R1 Rules Violation Issues - entire subdivision
strR1 = "'xxxxxxxxxxxxxxxx5; 'xxxxxxxxxxxxxxxx6;"
'****** SI_To = "'xxxxxxxxxx7'; 'xxxxxxxxxxxxx8'; 'xxxxxxxxxxxx9';"
' ******* SI_BCC = "'xxxxxxxxxxxxxxx9';"
SI_CC = " "
' ****** If Me.SIPage = True Then SI_To = SI_To & "'xxxxxxxxxxxx10';
'xxxxxxx11';"
If Me.OPRPage = True And Len(OPREmail) > 1 Then SI_To = SI_To &
Me.OPREmail
If Me.MOWPage = True And Len(MOWEmail) > 1 Then SI_To = SI_To &
Me.MOWEmail
If Me.MECHPage = True And Len(MECHEmail) > 1 Then SI_CC = SI_CC &
Me.MECHEmail
If Me.SIGPage = True And Len(SIGPage) > 1 Then SI_CC = SI_CC & Me.SIGEmail
If Me.SRMGRPage = True And Len(SRMGRPage) > 1 Then SI_CC = SI_CC &
Me.SRMGREmail
If Me.ETDPage = True Then SI_CC = SI_CC & strETD
'special handling for selected types of SI
If Me.OOFPage = True Then SI_CC = SI_CC & " 'xxxxxxxxxxx12';"
If Me.ETDPage = True Then SI_CC = SI_CC & strETDFail
If Me.RULESPage = True Then SI_CC = SI_CC & strR1
' setup to send message
If Len(Me.[SI Update Comments]) > 1 Or Me.[Has Updated] = True Then
SI_Subject = "UPDATE "
If [SI Page] = True Then SI_Subject = SI_Subject & "PAGE: "
SI_Subject = SI_Subject & "KC ROC SI: " & [SI Type] & " " & [SI
Subdivision]
& " Subdiv"
SI_Message = Format([SI Start Time], "hh:nn") & " " & [SI Type] & " " &
UCase([SI Subdivision]) & " Sub At " & UCase([SI Location]) & " "
'put updated comments at top of message
If Len(Me.[SI Update Comments]) > 1 Then
SI_Message = SI_Message & Chr(10) & "UPDATED INFO: " &
Me.SI_Update_Comments & Chr(10) & Chr(10)
[Has Updated] = True
[Updated Time] = Now()
End If
SI_Message = SI_Message & "SI DESCRIPTION " & UCase([SI Event
Description])
& Chr(10) & "COMMENTS: " & Me.[SI Comments]
DoCmd.SendObject , , , SI_To, SI_CC, SI_BCC, SI_Subject, SI_Message
[Has Emailed] = True
[Emailed Time] = Now()
Me.Refresh
Exit Sub
com147err:
Debug.Print Now()
Debug.Print err.Number
Debug.Print err.Description
Debug.Print SI_Subject
Debug.Print "TO " & SI_To
Debug.Print "CC " & SI_CC
'pause
'Stop
Exit Sub
End Sub
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
This is the debug print from the last execution....
1/11/2008 13:26:02
2295
Unknown message recipient(s); the message was not sent.
PAGE: KC ROC SI: **xxxxxxxxxxxxxx
TO 'OPR DL KCDAS'
CC
xxxxxxxxxxxxx
I know the TO recipient is a valid internal email name. .. I get the same
error if I remove the single quotes.
Believe it or not, we are running Windows XP Professional 2002 SERVICE
PACK
1,
the company where I work has not yet approved SP2 for installation on our
workstations.....
Hmm, with everything you have masked out above, I can't tell whether the few
mistakes I see exist in the original. For example, you posted this:
strR1 = "'xxxxxxxxxxxxxxxx5; 'xxxxxxxxxxxxxxxx6;"
But that's not valid, because you have a problem with the single-quotes.
The value of strR1 would be:
'xxxxxxxxxxxxxxxx5; 'xxxxxxxxxxxxxxxx6;
when it should be:
'xxxxxxxxxxxxxxxx5'; 'xxxxxxxxxxxxxxxx6';
In the test case you posted, was the message being sent *only* to "OPR DL
KCDAS"? I'm not sure whether you should expect 'OPR DL KCDAS' (in the
single-quotes) to be recognized or not. If, using Windows Mail, I send a
message to 'Dirk Goldgar' (in the single-quotes), it doesn't find the
contact entry that matches that name. But if I take it out of the
single-quotes, it does. I do recognize that you said you get the same error
if you remove the single-quotes, so I'm only speculating here.
If you make such a message manually, and enter the recipient as built above,
can the address be resolved?
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)