Results 1 to 5 of 5
  1. #1
    philliphalljr is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2018
    Posts
    8

    Hello


    Hello, like many here, I need some help. I have a database I have created, it lists accounts that are transferring in and out of our company along with the administrator of the account. I have several reports built, one of them is a summary broken down by Admin. What I would like to do is every Friday, send the individual admin their piece of the summary via email. My thoughts were to create reports for each admin, then a form with an email button for each one. Would this be the simplest way, or I there a different way. I would like to only have to hit 1 button and an email gets sent, maybe a macro for that???

  2. #2
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    The simplest way is to create a new Access database linking to the data you want to report on. Build your queries and the reports for those queries. Then you can run your reports and send them out. Look at the code for A better way (If you use Microsoft Outlook for your email)

    Code:
    Public Sub Masteremail(ByVal strfilename As String)
        Dim objOutlook As Outlook.Application
        Dim objOutlookMsg As Outlook.MailItem
        Dim objOoutlookRecip As Outlook.recipient
        Dim objOutlookAttach As Outlook.Attachment
        Dim sfile As String
        Dim filetocopy As String
        Dim fs As Object
        Set fs = CreateObject("scripting.filesystemobject")
        Set objOutlook = CreateObject("Outlook.Application")
        Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
        'Add list of recipients here
        objOutlookMsg.Recipients.Add ("recipient1@yourcompany.com")
        'Multiple recipients can be added using the statement above for each one 
       With objOutlookMsg
            .Subject = "Message Subject"
            .Body = ""
        End With
        sfile = "Path\filename"
        objOutlookMsg.Attachments.Add (sfile & "extension(.com,.xls,.xlsx,.pdf...")
        'Repeat the above 2 lines for each file to add
        'Send the email
        objOutlookMsg.Send
        'Clear out the objects
        Set objOutlookMsg = Nothing
        Set objOutlook = Nothing
    
    
    
    End Sub
    You will have to create another function to export the report or query to the file format needed and once that's complete call the above code to actually send the email.

  3. #3
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    The code in my previous post was provided to me by someone here in this forum but it was sometime ago and I don't remember who provided it.

  4. #4
    philliphalljr is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2018
    Posts
    8
    Thank you so much. When I get back to the office I will try this out. But while I am sick in bed I will try and understand what you provided.

  5. #5
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    If the only thing about the reports (aside from the data results they show) is who they go to, then there ought to be only one report. Suppose you need to add a new field/control to show data that you're not already. Do you want to have to fix this on 6 reports because you have 6 admins?
    send the individual admin their piece of the summary
    This could even be the same report you're using for showing all the admin records. I do believe that you'd have to open the report in such a way that it gets populated for 1 admin, then send, close and rinse/repeat. I seem to recall that sending a filtered report will email a version that contains all the records, not just the ones you were able to view when a filter was applied. In any case, it's a fairly common topic with posted code samples, and is the way I'd go. IMHO, the logic should dictate that if I have a form that appears to be the same when I open it to edit, or create new or delete a record, it is one form opened one of 3 ways, not 3 forms.
    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.

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