Results 1 to 3 of 3
  1. #1
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101

    Send Email Improvement

    Hi Guys, hope you can help.

    I have an action to send email as part of a close form button action.

    Code:
    DoCmd.SendObject acSendReport, strReport, acFormatPDF, StrTo, , , "Credit Note Raised (Edited)", "Please make the relevant stock changes for this/these items, see attached."
    This works fine, but it needs the email to be sent before the close form is completed. Additionally, if I cancel the send, it then goes to the debug/end option.



    I would therefore like to way to be able to cancel the send if not required as part of the process.

    Anyone any suggestions to improve this?

    Thanks

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    If you use Outlook automation you can trap the cancel error and simply move on.
    I don't think you can do that with within the SendObject process.

    If you search the similar threads below you should find some suitable code examples.
    If you are stuck with the code post back here.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Can you show the entire procedure including the End Sub? Do you have any error trapping?
    Here is a link that shows you how to add error trapping to catch the 2501 error (cancelled by user):
    https://social.msdn.microsoft.com/Fo...orum=accessdev

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 4
    Last Post: 07-12-2018, 05:38 AM
  2. Replies: 3
    Last Post: 12-28-2015, 04:11 PM
  3. Replies: 5
    Last Post: 09-14-2015, 07:24 AM
  4. Replies: 5
    Last Post: 05-07-2014, 09:25 AM
  5. Replies: 4
    Last Post: 04-13-2011, 10:11 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