Results 1 to 6 of 6
  1. #1
    Blueorangez is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    3

    Send a report using VBA

    DoCmd.SendObject acSendReport, "Events Order", acFormatPDF, "Firstname.lastname@email.com", , , "Events Order", "Please see attached the Events Order", False






    I'm using this to send a Report as PDF email and its working fine

    But I would like to reference a field name on my report instead of using "Events Order"

    each Events Order has Name field would like to put the name in the subject line rather than them all saying "Events Order"

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    maybe this will help
    https://docs.microsoft.com/en-us/off...cmd.sendobject

    the .subject line would reference the field name on your report that you need to include in the subject line for the email.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Blueorangez is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    3
    with the do.cmd send object the subject line is after the three , , ,

    , , , "Event Order"


    instead of event order as text

    I just want to put the name of the record I'm emailing

    like in excel I would use =Range(A2)


    I'm guessing would be something like

    , , , Reports [EVENT_NAME], "Please see report attached"

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    If the value is on the form the code is in, something like

    Me.Event_Name

    using the name of the control.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Blueorangez is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    3
    Thanks....

    that's exactly it. prefect.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Trying to send a report to a subfolder
    By Gina Maylone in forum Programming
    Replies: 2
    Last Post: 12-04-2014, 05:18 AM
  2. Send Report to webservice
    By Vanam in forum Reports
    Replies: 5
    Last Post: 11-25-2013, 05:04 AM
  3. Send Report to a NEW file
    By alyon in forum Access
    Replies: 9
    Last Post: 12-06-2011, 12:57 PM
  4. Help Send Report to File.
    By alyon in forum Access
    Replies: 4
    Last Post: 08-22-2011, 10:37 AM
  5. send object report
    By ldappa in forum Access
    Replies: 1
    Last Post: 07-19-2010, 10:10 AM

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