Results 1 to 8 of 8
  1. #1
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108

    Sending email through access 365


    Hello,
    What i want to be able to do is run a query, and group the results into an email and send it to a designated group of contacts. so if i run a report for everyone due an event on 1-1-2020 and it pulls in 10 people.. those 10 people have different groups of supervisors. I would like access to send an email to all the managers that fall under group a, b, c... so if bob and fred have the same supervisor it would pull those two names off and send it to the appropriate supervisor.. and then continue down the list. just wanting to know first off if anything like this is possible.. i know you can send emails ect.. but i didnt know if i would have to run a seperate report for each group then run a script to mailout?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    does docmd.sendTo ,work?

  3. #3
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108
    docmd.sendTo i think is what i will need to use.. i just ant find anything saying how to get the email addresses from the quarry.. I have POC1, POC2... i need it to pull each POC name and put it on the email..

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I'm going to leave my original answer (first paragraph) in place just in case it's relevant, but I'm now thinking it's not the case.
    I think because you have a many person to one manager thing going on, you'll have to use a code procedure, otherwise I see any query as being one that returns the manager name several times because of the many persons associated. So if in code you loop through your recordset and build a TO list for persons and a CC list for supervision you should be able to get what you need.

    You didn't actually say that you want to include the people who are 'due an event' - just the supervisors. Your query needs to include the email addresses for supervisors that it retrieves from the 'persons due' data. No idea what that looks like at your end.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108
    ok, so i run a report from our computer system of all employee's due a pay raise for a given period. Once i have the list i need to send the list to the Administrative officers (AO's) so they can distribute the names out to the appropriate managers. So if i run my report and get 10 names, 3 from org A, 2 from org B, 4 from org C and 1 from D what i would like is for Access be able to pull the 3 names from org A and email the 3 names to the listed AO's for org a, then send an email with the list of the 2 names from org B to the designated AO's and so on.. I cant have all 10 names sent to each AO, the names can only be sent to the specific AO's for the given org codes. The employee's are not included in these emails.

    not sure if that helps clarify or anything.. Thanks for all the help and effort

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    If you have a query that returns the org, AO email (name may or may not be useful to you; e.g. in terms of salutation) and the names (and whatever other personal info you need) of the subject person(s) then what? Is the report the list? You're sending a report or an email with a list of names/info in a message body? Is the report grouped by org or does it only contain the results for one org? Mixing up terms confuses me, and that's not hard to do!
    i run a report...i need to send the list
    The answers dictate which way I'd suggest to handle this.
    If your report is org specific, you can open it and use SendObject if your security setup allows it. Whether or not you do that manually for each org or as a coded process that sends as many reports as there are org's involved would be your choice.

    If you're sending an email body of details and not a report then you need code to construct an email and send it. If not using Outlook, that can be a problem. It would be easier to send one email to a list of recipients and let them find their data, but if it's private then it wouldn't be that much more difficult to send individual emails.

  7. #7
    willmafingerdo is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    108
    AO list
    Click image for larger version. 

Name:	AOList.JPG 
Views:	12 
Size:	75.7 KB 
ID:	40947


    Employee list
    Click image for larger version. 

Name:	EmpList.JPG 
Views:	12 
Size:	50.2 KB 
ID:	40946



    This is what data i am working w/.. the AO list pulls by AO_Code.. so when i run my query (Employee list) i would group by AO_Code and have it send all names for the given AO_Code to the POC on the AO list.. so any employee w/ the AO_Code BB would need sent to John.. employee's w/ the AO_Code BD would need to be sent to Katrina, Donna and Willie. the body of the email doesnt have to be anything more than "Attached is the list of employees eligable for WIGI xx/xx/xxx (this value would be populated by the pull criteria in my query so all the due dates would be the same)" its not a formal email. If it would be easier to just send an access report or something besides attaching an excel worksheet that would work too. I am using outlook 365 for my email app..If possible i would like to do this w/ as little VBA coding as i can, i am not really familiar w/ it.. but im not apposed to learning.. just would like to get something set up ASAP.. the old way of doing all this is very time consuming and tedious..

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Whichever method you use, you need something to launch this so I assume that will be a form button but there will be some code involved. My guess is that AO List is a query based on a table that looks just like that, which means the table is improperly designed (is not normalized) or it is an improperly designed query. If it's a query, maybe it can be fixed. If it's a table, then this will be a bit more difficult. You'll need to let me know about that if you want help with this and I will have to decide what the approach will be. You should also test that you can send email without any objects by using Automation first, otherwise there might be security blocks at your end. Create a test form with a button that has a click event and put this code into it (ensure you edit to provide a valid email address):
    Code:
    Dim oApp As Outlook.Application
    Dim oMail As MailItem
    Set oApp = CreateObject("Outlook.application")
    
    Set oMail = oApp.CreateItem(olMailItem)
    oMail.Body = "This is the body text"
    oMail.Subject = "Testing Email Send"
    oMail.To = "aValidEmailAddress@YourPlaceOfBusiness.com"
    oMail.Send
    Set oMail = Nothing
    Set oApp = Nothing
    If you use your own address as a test and it works, I'd suggest you also test sending to one or more of the other normal recipients to ensure there are no restrictions as to whom you can send email to when using code.
    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. Sending a value from Access to Outlook email
    By George in forum Import/Export Data
    Replies: 8
    Last Post: 09-03-2018, 02:53 AM
  2. Sending email from the Access Form
    By stalk in forum Programming
    Replies: 1
    Last Post: 05-15-2017, 12:59 PM
  3. Replies: 1
    Last Post: 11-07-2016, 11:18 AM
  4. sending email through Access
    By crowegreg in forum Import/Export Data
    Replies: 4
    Last Post: 04-15-2012, 03:49 PM
  5. Access sending email attachments
    By wee irish in forum Access
    Replies: 1
    Last Post: 03-06-2012, 06:11 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