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

Posted on 2014-10-22
Medium Priority
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 2000 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.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

801 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