Share via

Emailing through MSAccess using SendObject is limited when Outlook is the default mail handler

Anonymous
2014-03-24T17:58:45+00:00

SendObject works great when the default mail handler is Mozilla Thunderbird or Lotus Notes.  But SendObject "locks up" the current session of MSAccess when it stops at the Outlook mail message screen for the user to input the body of the email.   I understand SendObject is functioning like a dialog box in that instance, and therefore must prohibit returning to that instance of MSAccess.  I was wondering:

Is there a technique other than SendObject to start an email in MSAccess and not have it act like that, "locking up"? Then somehow I can test to see if Outlook is the default mail handler, and if it is, use this alternate code instead of SendObject.

The only thing I am using MSAccess for is:

   1. to capture the TO, CC, BCC and SUBJECT line of the email when I am attaching nothing, or 

   2. to capture the TO, CC, BCC and SUBJECT line and REPORT NAME when I am attaching a report

Thank you.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

11 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2014-04-10T13:52:35+00:00

    Ah I see, thank you for posting the code. The modal behavior is by design. Sorry, no easy way around that.

    One thing you could try is use GetObject to check if Outlook is running, and if yes, use VBA like the CreateEmailWithOutlook function at the bottom of the SendObject help page.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-04-10T00:17:13+00:00

    I am experiencing it on multiple machines in multiple environments across multiple companies. All programs are up to date with latest patches. All generic installations, nothing out of the ordinary.

    Again, only behaves this way with Outlook, not Thunderbird, not Lotus Notes.

    Here is my code:

    Public Function Email1()

    'from rol, no subj

    On Local Error GoTo Err

    If IsNull(Screen.ActiveForm.Email) Then

        MsgBox "An email address is required before using this feature", , "FYI"

    Else

        DoCmd.SendObject , , , Screen.ActiveForm.Email, , , , , True

    End If

    Err:

        If Err.Number = 2293 Then MsgBox "Please open email program before requesting email functions"

    'some email program like to be open before running this

        GoTo Out

        If Err.Number = 2501 Then GoTo Out

        MsgBox Err.Number & ", " & Err.Description

    Out:

    End Function

    Was this answer helpful?

    0 comments No comments
  3. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2014-03-27T13:38:28+00:00

    > when it stops at the Outlook mail message screen for the user to input the body of the email.

    I have never seen that. Don't even know how to make SendObject do that if I wanted to. You may have a really unusual Outlook configuration, but even then I don't know how to config Outlook like that if I wanted to. Maybe you can try this on a virgin machine or VM, with default installation of Windows and Office.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-03-27T13:21:04+00:00

    I suspect something else is going on here because Send object being a MS product is made to work with Outlook (another MS product) without any issues.  I have used it without problem in dozens of databases in diverse companies (IT setups).

    Please show us your code.

    Is Access up-to-date, is Outlook up-to-date?

    Alternatives, there are a number:

    Outlook automation (but then this just works with outlook)

    Using CDO Mail

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2014-03-26T18:34:56+00:00

    Anyone? Sure could use some help :-) Hope I am not being a pain...

    Was this answer helpful?

    0 comments No comments