Results 1 to 7 of 7
  1. #1
    darkdemon is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Posts
    12

    Access to send automated email in outlook

    Okay, I am not proficient with MS Access, but I found this code, but I do not know how to get it to use all the email addresses from the table if there are more than 1. Could anyone guide me on this?

    Private Sub cmdSend_Click()

    Dim strReportName As String
    Dim rsMail As New ADODB.Recordset

    Dim strMsgText As String
    Dim strSubject As String
    Dim strTo As String
    Dim strCC As String
    Dim strMsgFromDB As String



    strSubject = "My Subject Line is here..."
    rsMail.Open "qryMessagesToSend", CurrentProject.Connection, adOpenKeyset, adLockPessimistic

    rsMail.MoveFirst

    While Not rsMail.EOF

    strTo = rsMail("Clock")
    strMsgFromDB = rsMail("Message")

    strMsg = "" ' Reset for every time


    strMsg = "Hello " & rsMail("EmplName")

    strMsg = strMsg & vbNewLine & vbNewLine & strMsgFromDB


    DoCmd.SendObject acSendNoObject, , , strTo, , , strSubject, strMsg, True

    rsMail.MoveNext
    Wend

    rsMail.Close
    Set rsMail = Nothing

    MsgBox "Emails Sent"

    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you want to send 1 email with multiple addressees, review example in https://www.access-programmers.co.uk...ordset.236074/ which was already provided to you in other thread Pulling email addresses from 3 tables | Access World Forums (access-programmers.co.uk)

    Here's another https://www.access-programmers.co.uk...pients.185611/

    Use a loop structure to concatenate addressees from recordset. Then outside loop, send email.
    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.

  3. #3
    darkdemon is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Posts
    12

    Please stop June 7

    Thank you the link you provided actually helped for once.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by darkdemon View Post
    Thank you the link you provided actually helped for once.
    Now there's a thanks for you. And here I thought you were on my ignore list because of cross posting
    Last edited by Micron; 04-09-2022 at 04:15 PM.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    darkdemon is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Posts
    12
    Quote Originally Posted by Micron View Post
    Now there's a thanks for you. And here I thought you were on my ignore list because of cross posting
    This person June 7 is starting to stalk me.
    Last edited by darkdemon; 04-11-2022 at 12:12 PM.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If this is your first time on this site, how can you have 5 threads? I have replied in only one. How is helping considered 'stalking'? Aren't you here for help? I will make effort to ignore your threads (on all sites) from now on.
    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.

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by Micron View Post
    Now there's a thanks for you. And here I thought you were on my ignore list because of cross posting
    Actually, I remember now:

    Redacted from post 5 here
    https://www.accessforums.net/showthread.php?t=82505
    Obviously it doesn't work for me, then again, you so not seem to be reading my posts. I think I am done with this forum site, seems this site does not have people willing to help, just people willing to condemn.
    I'll let that speak towards your behaviour here thus far.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Send and SAVE outlook .msg email from Access VBA
    By kd2017 in forum Programming
    Replies: 3
    Last Post: 12-09-2019, 05:41 PM
  2. Replies: 4
    Last Post: 07-12-2018, 05:38 AM
  3. Send Email via Outlook from an Access form
    By ramirezx@ddmfg.com in forum Programming
    Replies: 3
    Last Post: 07-11-2018, 11:22 AM
  4. Replies: 15
    Last Post: 10-17-2015, 07:02 AM
  5. Send email from Access thru Outlook
    By ZMAN in forum Forms
    Replies: 2
    Last Post: 11-27-2010, 06:10 PM

Tags for this Thread

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