Results 1 to 10 of 42

Thread: Split In To Individual MS-Access Reports And Email To Corresponding Address

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    23
    Rep Power
    0

    Split In To Individual MS-Access Reports And Email To Corresponding Address

    Hi,

    I have the below code that will run my query, print my reports, save them in bulk as a single PDF, and send them in one email. I need help finding the right code to separate the reports so that each report will email individually to their corresponding email address in a table I have created (the reports gather data from this table as well). My code currently will generate and email and I have to click the send button--this is what I want. I want to be able to review the email before I send it.

    Can someone help me with the correct code I need in order to make this happen and also where to put the code in my current code?

    Any help would be GREATLY appreciated!! Thanks!

    Code:
    Private Sub Command11_Click()
    
    DoCmd.OpenQuery "Report Query"
    DoCmd.Close acQuery, "Report Query"
    
    DoCmd.OpenReport "DECO Import File", PrintOut
    'This will print the reports
    
    Dim stReport As String
    Dim stWhere As String
    Dim stSubject As String
    Dim stEmailMessage As String
    Dim stCaption As String
    Dim myPath As String
    'This sets the strings for each part of the email
    
    stEmailMessage = "Please see the attached collateral call for today."
    stSubject = "Collateral Demand"
    stReport = "DECO Import File"
    
    stCaption = "Collateral Demand" & Format(Now(), " mm-dd-yyyy")
    myPath = "J:\Investments\Trade Operations\Derivative Transactions\Collateral\Access Database\"
    
    DoCmd.SendObject acSendReport, stReport, acFormatPDF, , , , stSubject, stEmailMessage, True, ""
    DoCmd.OutputTo acOutputReport, stReport, acFormatPDF, myPath & stCaption & ".pdf", False, , , acExportQualityPrint
    
    End Sub
    Last edited by Excel Fox; 08-16-2013 at 08:08 PM. Reason: Code Tags

Similar Threads

  1. VBA To Extract Email Address From Text
    By dunndealpr in forum Excel Help
    Replies: 43
    Last Post: 06-05-2019, 03:56 PM
  2. Converting text to an email address hyperlink
    By Aerodynamix in forum Excel Help
    Replies: 2
    Last Post: 08-09-2013, 09:56 PM
  3. Replies: 2
    Last Post: 05-23-2013, 08:08 AM
  4. Replies: 6
    Last Post: 05-20-2013, 10:06 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
  •