Problem sending email from form in Access 2007 vb (DoCmd.SendObject)

We've upgraded from Access 2003 to 2007 and I'm having problems with a vb function sending emails from an Access form. Everything works fine - it opens the email box in Outlook, when I click on "send email" in Outlook it sends it immediately, BUT it doesn't close the email window. All commands in the window are disabled, if I wait about 20 seconds it closes itself, or I can click on the close button.
This never used to happen in 2003, when I sent the email the email window would close.
What am I doing wrong?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Any other code running other than the SendObject? Can you post the full SendObject call?

good afternoon!

can u post ur code of sending email.


try this approach!

sub Send
    Dim objMsg As Object
    Dim objConfi As Object
    Dim strBody As String
    Set objMsg = CreateObject("CDO.Message")
    Set objConfi = CreateObject("CDO.Configuration")
    With objMsg
        Set .configuration = objConfi
        .to = <receiver>
        .from = <sender>
        .Subject = "Test"
        .textbody = "This is a test message only."
    End With
    MsgBox "OK"
end sub
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

GoCellular_caAuthor Commented:
 Thanks for the tip, but with your code I'm getting the error "Runtime Error -2147220960 (80040220) The SendUsing configuration is invalid"

No, there's no code running apart from this:
DoCmd.SendObject acSendNoObject, , acFormatRTF, strRecipient, , , strRegarding, strBodyText, True

strRecipient, strRegarding and strBodyText are all simple text strings - I've tried writing recipient etc. directly in the DoCmd.SendObject line but it makes no difference.
I"m beginning to think that this might be a problem with Outlook 2007 instead of a local problem in Access?
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
SendObject does nothing more than open the message in Outlook (or whatever your default email client happens to be). Once this happens, processing is passed to Outlook. If you have code running after this line (add a MsgBox to verify this), that code will fire immediately - which indicates that Access has passed the object to Outlook and returned to it's own code duties.

As to why this worked in 03 - I've never had it work this way. If I use SendObject with the Show argument set to True, then Outlook would open my message and wait for me to do something with it, but it wouldn't close. As I've said many times before 2007 is much more picky about code and such, and many things that worked in earlier versions have been fixed (for right or wrong) in 2007. Access should have never had any control over the email client simply by calling SendObject ... it would be different if you were actually automating your client, but SendObject does nothing more than add an email to the Outbox of the email client - nothing more. The Show argument (i.e. the one you set True to view the message) simply showed the message and allowed you to interact with it.

good morning!

i will give u this link that will show you codes and help on how to send
email using different methods... i hope u can see this knowledgable.

U can also download the excel here which has the code...

I hope i could help you...



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GoCellular_caAuthor Commented:
@game-master: works perfectly, thank-you very much for your help!

good morning!

Im glad i could help..

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.