Can't send email generated from other office program without unspecific error message "The operation failed".

Posted on 2014-10-22
Last Modified: 2014-10-27
I have an access database and an excel spreadsheet that are set up to generate emails in outlook.  These have always worked without any issue, but since the end of last week, although the email window is created as normal, when the user clicks on the 'Send' button, Outlook generates and error - "The operation failed."

However, if I open Outlook and then create a new email message and copy and paste the information to this new email window, it sends without error.

I am using Office 2010 in a Terminal Server environment, and Outlook is connected to an Exchange 365 server.  I have tried restarting the server and deselected and reselected the appropriate library files within access and this has not fixed the problem.  I'm guessing there may have been an update that is causing me problems.

Please help!
Question by:thechrisrobertstoo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40396555
First thing to do is make sure Office and Windows are fully updated, including all Service Packs and relevant Hotfixes.

Might want to check the Event Viewer on the machine immediately after this fails, see if you find any MAPI or other relevant errors.

Does the email have an attachment? If so, try using Access to send the email only, without the attachment, and see if it fails.

Otherwise, I'd try using your code to create the simplest email you could - just a SendTo, Subject and Body - and see if that goes through. If it does, start adding other attributes your code uses, and see where/when it fails.

Author Comment

ID: 40396625
Ok, this is interesting, because having written a very simple subroutine to just generate an email for me to send, it works correctly, but the crux of the mail generating code is the same as what I'm using in my Access form.  I don't have anything more complicated than subject and body text, I don't even complete the 'To' field as this is not useful for this process.

Still driving me nuts!  Unfortunately I have an urgent need to work on something else, so I will have to leave this until tomorrow.
LVL 85
ID: 40396670
You may have some corruption in the database file. Try creating a new, blank database and importing everything to that database, and see if the trouble goes away.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 40396674
I might agree, except I experience the exact same issue when generating emails from an Excel spreadsheet.
LVL 85
ID: 40396747
Does this happen on multiple RDS desktops, or only one?

If it's only one, you might have a corrupt user profile. If so, then you generally have to recreate that profile.

If it happens on multiple RDS desktops, then my guess would be inconsistency in the install of Outlook on the RDS system. You'll very likely have a difficult time convincing the IT people of that, of course.

deselected and reselected the appropriate library files within access
Are you using early or late binding? If you're using Early binding (where you write code like Dim otl As Outlook.Application), you might try switching over to Late binding.

Also - are all users of the database running the same version of Access, and the same version of Outlook? Generally this is the way things work, but I've seen some situations where RDS systems were configured differently.

Accepted Solution

thechrisrobertstoo earned 0 total points
ID: 40396783
Yes, it happens for all users, and they all use the same version of Access.  I'm also using early binding.

Because I'm like a dog with a bone, I haven't been able to leave this alone and have found that if I call a separate subroutine to handle the email window AND if I remove the code that determines the BodyFormat of the email (normally set to olFormatPlain), I've managed to get it working.

It occurs to me that these failures only started after a routine re-boot of the TS server, though I can't for the life of me think why any security updates would object to email BodyFormats.

Now all I need to do is test it a bit more and then roll out these changes to my Excel spreadsheet as well.

I appreciate all your helpful suggestions, many thanks.
LVL 85
ID: 40396896
That is very odd ... rebooting the machine shouldn't have any impact on that, it would seem - but then who knows.

Still think it would be prudent to perform maintenance on your database. Make a backup, then do this:

1. Compact the database
2. Compile the database - from the VBA Editor, click Debug - Compile. Fix any errors, and continue doing this until the menu item is disabled.
3. Compact again

Might also want to Decompile the app. To do that, create a shortcut with this as the Target:

"full path to msaccess.exe" "full path to your db" /decompile

Run this shortcut, then do the 3 steps above again.

Finally, it's sometimes a good idea to create a new, blank database and import everything to that db. This can clear up any container corruption you might have.

But be sure to make a backup before you start anything ...

Author Closing Comment

ID: 40405951
The solution turned out to be trial and error, though I never addressed the cause of the issue.  Scott was very helpful in encouraging a step-by-step approach to solving this so he can have all the points.

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question