Have to concatenate the variable as shown in post 12.
.Body = "The attached CRs are available for the next CCB." & vbCrLf & vbCrLf & strMsg & vbCrLf & vbCrLf & "V/R" & vbCrLf & vbCrLf & "Signature Block"
Have to concatenate the variable as shown in post 12.
.Body = "The attached CRs are available for the next CCB." & vbCrLf & vbCrLf & strMsg & vbCrLf & vbCrLf & "V/R" & vbCrLf & vbCrLf & "Signature Block"
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thank June,
Duh, Gotcha now and I get 1 line added in the email - Getting to where I want to be. It looks like it isn't doing the next line, or until completion.
This is the main part of the code:
Do I have something out of place?Code:Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookAttach As Outlook.Attachment Dim strBody, strAddresses, strSubject, strMsg As String Set rs = CurrentDb.OpenRecordset("SELECT Status,CR_Number,[Change Requested]FROM Daily_Actions_Email ORDER BY CR_Number DESC") Set objOutlook = CreateObject("Outlook.Application") Set objOutlookMsg = objOutlook.CreateItem(olMailItem) rs.MoveFirst While Not rs.EOF strMsg = rs!Status & Chr(10) & Chr(9) & "CR " & rs!CR_Number & " - " & rs![Change Requested] rs.MoveNext Wend rs.Close With objOutlookMsg .Subject = "Todays AORB/ERB/CCB outcome - " & Format(Date + 1, "dd mmm yyyy") .Body = "Todays AORB/ERB/CCB outcome." & vbCrLf & vbCrLf & strMsg & _
Why using Chr(10) & Chr(9)?
Chr(13) & Chr(10) is the same as vbCrLf
As shown in post 4:
strMsg = strMsg & rs!Status & " CR " & rs!CR_Number & " - " & rs![Change Requested] & vbCrLf
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Gotcha on Chr(10) but I wanted a tab and all I know is Chr(9) and it works for me. I guess I can add 5 spaces before CR to remove the CHR(9). I had & vbCrLf on the end, but it didn't seem to do anything. I still get a one line from a possible 7 lines for today. (This is after I made changes from your suggestions. I have moved the StrMsg to after rs.MoveFirst, after rs.MoveNext - it still makes one line.
This is the query I am referencing:
SELECT Chng_ReqQry.CR_Number, Chng_ReqQry.Status, Chng_ReqQry.[Change Requested]
FROM Chng_ReqQry
WHERE (((Chng_ReqQry.[Change Requested])<>"Do not delete") AND ((Chng_ReqQry.Date_Closed)=Date()))
GROUP BY Chng_ReqQry.CR_Number, Chng_ReqQry.Status, Chng_ReqQry.[Change Requested]
ORDER BY Chng_ReqQry.CR_Number;
The Chr(10) & Chr(9) and vbCrLf all work for me. My email body is multiple lines and tabbed.
Wait! Refer to post 4 again:
strMsg = strMsg & rs!Status & " CR " & rs!CR_Number & " - " & rs![Change Requested] & vbCrLf
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks June7
strMsg = strMsg & did it for me. Works like a charm. Mucho appreciated!!!!1