Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with a converted macro 'SendObject' (Access 2000)

    I am trying to automate an email procedure from my access database. When I run sendobject from a macro, it works fine. Because I need to address the email automatically, I converted it to VBA and used a variable for the "TO:" option. When this runs it works fine the first time, but will not run again until I shut down Access and open it again. Its as if something needs to be reset at the end of the function before the sendobject will work again.
    Any help greatly appreciated.
    My VBA is below:

    Function Test_Email_VBA()
    On Error GoTo Test_Email_VBA_Err
    mailname = Forms!frmmain!CustomerName
    Beep
    MsgBox "You may need to address the email to that is created using the normal address book yourself. The planner memo will be included as an attachment. You may add extra comments to the main message if required.", vbInformation, "EMail to Planner"
    DoCmd.SetWarnings False

    DoCmd.SendObject acReport, "rptPlannerMemo", "SnapshotFormat(*.snp)", mailname, "", "", "Mapping Centre - Site Plan added to EMU", "The Mapping Centre have added your site plan to EMU - Please see the attached memo for full details", True, ""
    DoCmd.SetWarnings True



    Test_Email_VBA_Exit:
    Exit Function

    Test_Email_VBA_Err:
    MsgBox Error$
    Resume Test_Email_VBA_Exit

    End Function


    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Problem with a converted macro 'SendObject' (Access 2000)

    What happens if you take out the two DoCmd.SetWarning instructions?

    I you use Outlook for your e-mail, the problem might be caused by Outlook security. This protects you against sending e-mails programmatically, which is precisely what you are trying to do. There is a free utility ClikYes that helps to get around this.

  3. #3
    New Lounger
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Problem with a converted macro 'SendObject' (Access 2000)

    Hans,

    Thanks for your reply. Removing the setwarning lines has no effect.
    I don't think my company IT people would allow the use of clikyes.
    I will stick to manual addressing.

    Thanks again

  4. #4
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Problem with a converted macro 'SendObject' (Access 2000)

    SendObject is not very reliable, and is designed for simple macros. According to MS, "Microsoft has confirmed that this [failing to send message more than once] is a problem in Microsoft Access 2000. " See MSKB Article 260819:

    ACC2000: SendObject Method Fails in Access 2000

    Article notes (under "Symptoms"): "When you use the SendObject method in Microsoft Access 2000 to send an e-mail message, you encounter one of the following symptoms:

    "The SendObject method silently fails. That is, the message is not sent, and you do not receive any error message or any notification that the message was not sent."

    The article provides several possible resolutions. One is to use the Collaboration Data Objects (CDO) library to create and send an e-mail message and attachment using MAPI functions; sample code is provided. As noted in article, CDO may not be installed on user's computer; it is not "automatically" installed when you install Office 2K if you did not select this option. Also article notes, "If you installed Microsoft Outlook in the Internet Mail Only (IMO) mode you cannot use CDO and MAPI." For details see MSKB Article 252720:

    INFO: MAPI and CDO Are Not Supported in Outlook IMO Mode

    If the CDO/MAPI code looks intimidating, a simpler solution is to automate procedure using Automation with Outlook (I use latter approach), if you or your users use Outlook/Exchange as your e-mail system. For sample code see MSKB Article 161088:

    Using Automation to Send a Microsoft Outlook Message

    The only drawback with using Outlook is that security settings on user's installation of Outlook (or on the Exchange server in corporate environment) may preclude or interfere with automating the entire procedure. For more info see MSKB Article 262631:

    OL2000: Information About the Outlook E-mail Security Update

    If none of the suggested solutions resolve problem, you may have to resort to using a 3rd-party product to accomplish task.

    HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •