Emailing from access using SendObject

When I use sendobject to send email (VBA code in MS Access), Access locks up until I Send the message in Outlook, After I send the email, I can then go back to Access.  Is there a way to free up Access after I execute the docmd.sendobject command but before I hit the Send button in Outlook?  Some of our users use Outlook, some use other email programs. The other email programs (Mozilla Thunderbird and Lotus Notes) do not cause this "lock up."  Here is my code:

Public Function Email2()

On Local Error GoTo Err

If IsNull(Screen.ActiveForm.txtEmail) Then
    MsgBox "An email address is required before using this feature", , "FYI"
Else
    DoCmd.SendObject , , , Screen.ActiveForm.txtEmail, , , [Forms]![matters]![MatterName], , True
End If

Err:
    If Err.Number = 2293 Then MsgBox "Please open email program before requesting email functions", , "LP"
    GoTo Out
    If Err.Number = 2501 Then GoTo Out
    MsgBox Err.Number & ", " & Err.Description

Out:

End Function

Thank you so much for any help.

Are you creating an e-mail that needs to be edited? If not, change the True at the end to False. and it will just send the mail. 
Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Microsoft Access MVP since 2007

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Yes, it needs to be edited. 

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

The Edit step pretty much takes over. It's like opening a form in Dialog mode. The code is stopped until the email is sent. The other email programs are not tied to Access the way Outlook is. Nor do they have security that stops any program from sending an Outlook email without the user's manual permission.
Bill Mosca
ThatllDoIT.com

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I see. So how can I work around it? How can I use Access to populate the TO, CC, BCC and SUBJECT lines, then leave the Outlook message screen open for them to type their message and not be "locked out" of Access while doing so? Remembering that some users still are on other email programs, so the code would have to consider that...

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Karen

I don't know of a work-around for that. Access VBA is designed that way. Maybe calling the SendObject when the form closes would be better. I don't know. It depends on the workflow.

Bill Mosca
ThatllDoIT.com

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thank you anyway. I have started a new thread because I want to approach this from a different angle, and felt a new thread was the proper way to do it.          

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 551 Applies to: