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

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!
Who is Participating?
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:
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.
thechrisrobertstooAuthor Commented:
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.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

thechrisrobertstooAuthor Commented:
I might agree, except I experience the exact same issue when generating emails from an Excel spreadsheet.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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.
thechrisrobertstooAuthor Commented:
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.

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
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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 ...
thechrisrobertstooAuthor Commented:
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.
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 Office

From novice to tech pro — start learning today.