If I run the code as such and it works:
Code:
Dim rs As Dao.Recordset
Dim objOutlook As Outlook.application
Dim objOutlookMsg, objOutlookMsg1, objOutlookMsg2 As Outlook.MailItem
Dim objOutlookAttach As Outlook.Attachment
Dim strMsg As String
Dim CRNum, DateTypes As Variant
Set rs = CurrentDb.OpenRecordset("SELECT Status,CR_Numbers,[Change Requested]FROM Daily_Actions_Email ORDER BY Status,CR_ID ASC")
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
Set objOutlookMsg1 = objOutlook.CreateItem(olMailItem)
Set objOutlookMsg2 = objOutlook.CreateItem(olMailItem)
CRNum = DLookup("[CR_Numbers]", "[Daily_Actions_Email]")
If IsNull(CRNum) Then
With objOutlookMsg
.Subject = "There were no actioned CR's - " & Tod
.Body = "The email addressing is a living entity. If there are corrections, additions, or deletions, please notify the sender." & vbCrLf & vbCrLf & _
"There were no actioned Change Requests for " & Tod & "." & strSigBlock
.To = "CCB Results"
.Display
DoCmd.Close acReport, "Daily Actions"
Exit Sub
End With
Else
End If
rs.MoveFirst
While Not rs.EOF
strMsg = strMsg & rs!Status & vbCrLf & Chr(9) & "CR " & rs!CR_Numbers & " - " & rs![Change Requested] & vbCrLf
rs.MoveNext
Wend
rs.Close
With objOutlookMsg1
.Subject = "Today's AORB/ERB/CCB outcome - " & Tod
.Body = "The email addressing is a living entity. If there are corrections, additions, or deletions, please notify the sender." & vbCrLf & vbCrLf & _
"Today's AORB/ERB/CCB outcome." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "V/R" & vbCrLf & vbCrLf & "Name" & vbCrLf & vbCrLf & "Command" & vbCrLf & "Division" & vbCrLf & "Address1" & vbCrLf & "City and Zip" & vbCrLf & "Phone" & vbCrLf & "EMail"
DoCmd.OutputTo 3, "Daily Actions", acFormatPDF, "C:\Temp\Daily Actions - " & Tod & ".pdf", , 0
.Attachments.Add ("C:\Temp\Daily Actions - " & Tod & ".pdf")
.To = "CCB Results"
.Display
DoCmd.Close acReport, "Daily Actions"
Kill "C:\Temp\Daily Actions - " & Format(Date, "dd mmm yyyy") & ".pdf"
End With
strMsg = ""
If IsNull([CRNum]) Then
End If
With objOutlookMsg2.........
I made changes as shown in Orange Bold letters
Output looks like:
The email addressing is a living entity. If there are corrections, additions, or deletions, please notify the sender.
Today's AORB/ERB/CCB outcome.
Status
CR ### What was requested
Status
CR ### What was requested
Status
CR ### What was requested
Signature block
If I change it to:
Code:
With objOutlookMsg1
.Subject = "Today's AORB/ERB/CCB outcome - " & Tod
.Body = "The email addressing is a living entity. If there are corrections, additions, or deletions, please notify the sender." & vbCrLf & vbCrLf & _
"Today's AORB/ERB/CCB outcome." & strSigBlock
I lose my text output on the email.
Output looks like:
The email addressing is a living entity. If there are corrections, additions, or deletions, please notify the sender.
Today's AORB/ERB/CCB outcome.
Signature block
What am I missing here?
Sig Block code =
Code:
Option Compare Database
Public Const strSigBlock As String = vbCrLf & vbCrLf & "For your action." &"V/R" & vbCrLf & vbCrLf & "Name" & vbCrLf & vbCrLf & "Command" & vbCrLf & "Division" & vbCrLf & "Address1" & vbCrLf & "City and Zip" & vbCrLf & "Phone" & vbCrLf & "EMail"