Results 1 to 8 of 8
  1. #1
    nzlowie is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    5

    Emailing Reports

    Hi all



    I've just done a search of previous posts but can't find what I'm looking for.... I have a db that tracks job in my work shop, produces a job card and various other reports. I have a command button to print the invoice once the job is completed, what I'd like to do have a separate button (or an option from the print button) to send the report directly to the email listed for the customer. I know I can do it the manual way..... one button click would be good!

    (not an experienced programmer, just fumbling in the dark!)

    Many thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You can use SendObject, either getting the email address from the form or with a DLookup() or recordset. Depending on how you set it up, you may need to filter the report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    nzlowie is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    5
    Thanks Paul

    Could you please give me an example of code to try?

    Cheers

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Lots of examples in forum and web.

    https://www.accessforums.net/access/...ess-55101.html

    https://www.accessforums.net/program...ook-21903.html

    https://msdn.microsoft.com/en-us/lib...or=-2147217396

    If you want to send a filtered report, I believe will have to first open the report. That can be done with the OpenReport method.
    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.

  5. #5
    nzlowie is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    5
    I've been looking and trying to piece bits of code together from various web sites with no luck, that why I posted the question here.

    Over the years I've had a great deal of coding help form the various forums I've called on, not asking for much.....

    Regards

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    We don't know specifics of your situation so can't get too detailed. But two primary lines of code you would need are probably:

    DoCmd.OpenReport "report name", acViewPreview, , "some filter criteria here"

    Docmd.SendObject acSendReport, , , "email address here", , , "subject here", "some message here"

    "email address here" can instead be reference to a field/control on form: Me.textboxname

    Then if you want:

    DoCmd.Close acReport, "report name"


    If you have attempted something, what was it? What happened - error message, wrong results, nothing? Post code for analysis.
    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
    nzlowie is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    5
    Thanks I'll start playing with that tonight and see how we get on...
    Cheers

  8. #8
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Here's an older tutorial that may be helpful

    http://www.datapigtechnologies.com/f...sendemail.html

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

Similar Threads

  1. Emailing Reports
    By ssworthi in forum Reports
    Replies: 4
    Last Post: 08-25-2015, 04:44 PM
  2. Emailing Muliple Reports
    By GWILKIE in forum Access
    Replies: 4
    Last Post: 10-25-2013, 02:46 PM
  3. Emailing reports from access
    By doopml in forum Programming
    Replies: 3
    Last Post: 10-24-2012, 11:18 AM
  4. Replies: 2
    Last Post: 05-20-2011, 10:18 AM
  5. Emailing forms or reports
    By dcecil in forum Reports
    Replies: 6
    Last Post: 12-16-2009, 07:57 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