+ Reply to Thread
Results 1 to 2 of 2

Looping through email body to include all records in query in Access.

  1. #1
    Registered User
    Join Date
    11-17-2011
    Location
    South Africa
    MS-Off Ver
    Access, Excel 2010
    Posts
    52

    Looping through email body to include all records in query in Access.

    Hi all,

    I have the following code that sends an email to all the email addresses generated by a query. I want it to include information in the email body and loop through each record and put the information of each in a new line in the email body. The code I have only puts one record in the email body instead of all the records. I also want it to send the email to the address only once if the email address appears more than once. IOW, if there are 10 records and only 2 different email addresses (4 records for the one email address and 6 for the other email address), it must only send out 2 emails with the respective records in each. Here is the code i have so far:

    Please Login or Register  to view this content.
    Thank you in advance.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Looping through email body to include all records in query in Access.

    you can send the query with a single line of code

    DoCmd.SendObject acSendQuery, sQuery, acFormatXLS, sTo, , , sSubj, sMsg

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Change code to include picture in body of email
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2013, 01:22 PM
  2. Replies: 1
    Last Post: 08-13-2013, 03:25 AM
  3. [SOLVED] Access body email to Outlook
    By rmachbitz in forum Access Tables & Databases
    Replies: 4
    Last Post: 07-08-2013, 09:39 AM
  4. Email macro, include variable in body & add default outlook signature
    By promithius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2013, 09:05 AM
  5. VBA outlook - Include sheet4 in body of the email
    By xatomicx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2010, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1