Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    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.

  2. #17
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845
    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:

    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 & _
    Do I have something out of place?

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    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.

  4. #19
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845
    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;

  5. #20
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    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.

  6. #21
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845
    Thanks June7
    strMsg = strMsg & did it for me. Works like a charm. Mucho appreciated!!!!1

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Listing fields
    By geraldk in forum Queries
    Replies: 19
    Last Post: 04-17-2012, 01:49 PM
  2. Replies: 3
    Last Post: 03-23-2012, 06:16 AM
  3. ComboBox not listing values
    By tylerg11 in forum Access
    Replies: 1
    Last Post: 09-23-2011, 10:28 AM
  4. Query Not Listing All Items
    By Rawb in forum Queries
    Replies: 7
    Last Post: 05-14-2010, 08:00 AM
  5. One to Many Listing in Forms
    By zunebuggy in forum Forms
    Replies: 5
    Last Post: 05-11-2010, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums