Docmd.SendObject stopped to work after installing Outlook 2016

Hi Experts,

We have an Access app that is used with Access 2007

The docmd.SendObject to send emails stopped working since we upgraded our Outlook to 2016.

We're getting the attached error msg.1
Any way to make this work again?
LVL 6
bfuchsAsked:
Who is Participating?

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

x
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.

mlmccCommented:
Not sure if this is the issue but we had a similar issue several years ago and had to set a flag in Outlook to allow an application to send an email.

I don't recall where that flag was but it was added to prevent untrusted applications from sending emails (spam)

mlmcc
0
bfuchsAuthor Commented:
Hi

I wanted to do that but its grayed out.
See attached.

Thanks,
Ben
Untitled.png
0
Jeffrey CoachmanMIS LiasonCommented:
Can you post the code, and let us know what line the error occurs on?
0
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.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Anything else change, like the location of the database?

Might review the Trusted Locations to ensure the Access db is located in one.
0
bfuchsAuthor Commented:
@Jeff,
    DoCmd.SendObject , , , , , , Trim(Me.FirstName & " " & Me.LastName), "Received documents."

Open in new window

@Scott,
Nothing at all changed besides upgrading the office to 2016 (except Access which 2007 is still in use).
Will see if trusted location helps..


Thanks,
Ben
0
bfuchsAuthor Commented:
@Scott,

Is there a way I can add a location to the trusted locations using A2003 (I use that for programming)?

Thanks,
Ben
0
Jeffrey CoachmanMIS LiasonCommented:
Just for fun, try sending a report with all the major arguments filled in:

DoCmd.SendObject acSendReport, "rptTest", acFormatRTF, "YourEmailAddressHere", , , "Test Subject", "Test Message"

It may also be that the "event" you are using is no longer valid for sending emails...?
What event are you using? (was this same event code working in the previous version?)

...and what "state" is your application in when it errors?
Perhaps the current record was not saved/committed when your code runs...?

I tested code, like what I suggested above, in 2016 and it worked fine.

Also try running the Compact and Repair utility in the DB.

JeffCoachman
0
bfuchsAuthor Commented:
Hi Experts,
Might review the Trusted Locations to ensure the Access db is located in one.
That didn't help..
Just for fun, try sending a report with all the major arguments filled in:..
Didnt work either..
I tested code, like what I suggested above, in 2016 and it worked fine.
Perhaps the reason is that its an ADP and users are forced to use A2007, while the rest office got upgraded to 2016?
(was this same event code working in the previous version?)
Just reassuring, everything in the app is the same, nothing changed besides the new Outlook.

Thanks,
Ben
0
mlmccCommented:
When trying to do this, do you have to add the Outlook library or assembly to Access?  The reference to it may need to be updated.

mlmcc
0
bfuchsAuthor Commented:
@mincc,

1- We do have reference to Outlook 16.0 library.
2- Besides the docmd.SendObject never required a reference to extra libraries, as was built into Access defaults..

Thanks,
Ben
0
mlmccCommented:
Been a long time since I did it so wasn't sure.

mlmcc
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
SendObject doesn't require a reference. Are you also using code that requires that Outlook 2016 reference?

Much as I hate to say it (and you to hear it), you may be running into issues with that .adp format in newer versions. As you're aware, MSFT stopped supporting the .adp format as of Access 2013 (https://msdn.microsoft.com/en-us/library/office/jj618413.aspx), so no regression testing would be performed for newer versions of Access. If it works in 2007, but not 2016, it's something to consider.
0
bfuchsAuthor Commented:
@Scott,

This has nothing to do with the file being an ADP.

Just tested with an A2003 MDB and the same is happening there.

See attached.

Thanks,
Ben
Untitled.png
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
This has nothing to do with the file being an ADP.

Just tested with an A2003 MDB and the same is happening there.
Same could be said of the .mdb/.mde format as with the .adp - incompatibility between a very old format and the new version of Outlook.

Just curious - what happens if you run that code in a .accdb format file with 2016? I use SendObject regularly with .accdb formatted files, but I haven't run into the scenario where I have an older .mdb or .adp format file with 2016.
0
bfuchsAuthor Commented:
Hi Scott,

Sorry for my late response.

Just curious - what happens if you run that code in a .accdb format file with 2016?
My PC only has A2003, hope to get hold of a later version tom & test this out.

Thanks,
Ben
0
bfuchsAuthor Commented:
@Scott,

I got to test at another pc with Outlook 2016 and it worked with all versions MDB and ACCDB.

I also tried with that pc using A2003 in an MDB file and also worked.

So I am kind of confused, what exactly is causing my pc (same as a couple of other users) this error?

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I got to test at another pc with Outlook 2016 and it worked with all versions MDB and ACCDB.
Then it would seem it does work, but only on certain machines.

About the only thing I could suggest would be to compare actual versions of all relevant pieces to see if they are all compatible. For example, in Access 2016 I can look at the Account page and see that I'm running "Microsoft Office Professional Plus, Version 1710, Built 8625.2127". Compare those, and see if something is amiss with the trouble machines.

Also, it could be something entirely different - for example, the version of DAO/JET/ACE on each machine. Unfortunately, when trying to troubleshoot issues like this on unsupported platforms, it's kinda hard to figure out what "correct" is.
0
bfuchsAuthor Commented:
Hi,

For example, in Access 2016 I can look at the Account page and see that I'm running "Microsoft Office Professional Plus, Version 1710, Built 8625.2127". Compare those
Not sure where do I find this account page.
But really I need it in A2007 to work, so would need to know where can I find this info there as its not between the main menus.

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You get to a bit differently in 2007. Click the big Office button >> Access >> Resources. There should be an "About" section on the page with version and build information.
0
bfuchsAuthor Commented:
Ok,

The trouble one is Access 2007 12.0.4518.1014

The good is currently offline..will try to get to it tom.
But that one also has A2013, perhaps this also matters?
Also, it could be something entirely different - for example, the version of DAO/JET/ACE on each machine
How do I figure out this?

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Only way to do that would be to create a machine with the barebones on it (Windows and Office) and then add other components (or other combinations of components) until you figure out which one causes the troubles. This can be a long and difficult path, of course.

Be sure all machines are fully up to date on all relevant pieces of software (Windows, Office, etc).

Try temporarily turning off antivirus to see if that is the culprit (long shot, but ya never know).
0
bfuchsAuthor Commented:
Hi,
Try temporarily turning off antivirus to see if that is the culprit (long shot, but ya never know).
Tried that, didnt help-:(

Still waiting to get on the working pc again to do the comparison.

Thanks,
Ben
0
bfuchsAuthor Commented:
@Scott,

From all the people I saw in google complaining about this error, so far the only one posted solution was the following
https://www.access-programmers.co.uk/forums/showthread.php?t=277995
Thank you for your help, Everyone! I appear to have solved the problem.

I noticed that the access wizards were not working this afternoon (I used a query wizard to start the structure of an SQL statement). That made me think that my copy of Access had somehow become corrupted.

Using the Windows Add/Remove programs feature, I repaired Runtime 2013 and did a quick repair of my copy of Office 365. After that, SendObject commands worked as they had in the past..
Then I realized my link table manager is also not working, tried office repair & didnt help, didnt restore my link table wizard either...

Thanks,
Ben
0
bfuchsAuthor Commented:
I tried creating a replacement as follows

Public Sub MySendObject(sTo As String, sSub As String, sCC As String, sBcc As String, ByVal shtmlBody As String)
 Dim outApp As Outlook.Application, outMsg As MailItem
 Dim itm As Variant
 On Error GoTo err
 Set outApp = CreateObject("Outlook.Application")
 Set outMsg = outApp.CreateItem(olMailItem)

    With outMsg
        
        .To = sTo
        .CC = sCC
        .BCC = sBcc
        .Subject = sSub
         .Body = shtmlBody
       ' .htmlBody = shtmlBody
'        .ReadReceiptRequested = True
'        .send
        
    End With

Set outApp = Nothing
Set outMsg = Nothing
ErrExit:

Exit Sub
err:
    MsgBox err.Description
    GoTo ErrExit
End Sub

Open in new window

Something that worked with previous versions, but now I get error msg "Error loading DLL"

We do have reference to latest Outlook library, see attached.

Thanks,
Ben
Untitled.png
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
If you're running 2007 or greater, be sure the folder hosting the database is added as a Trusted Location. Not sure if those can get screwed up if you upgrade Outlook or not, but it's worth a look. Of course, anything below 2007 didn't use Trusted Locations.

If you're going to automate Outlook, you don't need a reference to Outlook. Late Binding techniques use whatever version of Outlook is on the machine.
0
bfuchsAuthor Commented:
Hi Scott,

All users had their pwd changed this week, could not get hold of any A2007 - O2016 pc yet, hope to test that on Sunday.

However in my scenario where I have A2003 and Outlook 2016, is there a way to make that work?

I would be satisfied if any of these work, either SendObject or the function I posted above (ID: 42410005
) to substitute that.

Thanks,
Ben
0
bfuchsAuthor Commented:
Hi Scott,

I just got hold of pc A2007 O2016 and

1- Tested with application under trusted location, didnt help.

2- When tested the MySendObject posted above it did work, however its just sending the msg, and what we really want is opening the Outlook editor where users can edit the msg, just the way sendObject used to work.

Please let me know how to proceed.

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Try specifically including the EditMessageargument:

DoCmd.SendObject , , , , , , Trim(Me.FirstName & " " & Me.LastName), "Received documents.", True

You might also consider including other items, like acSendNoObject. Sometimes, code that worked perfectly fine in 2003 would have troubles in later versions, and specifically specifying optional arguments seemed to help.
0
bfuchsAuthor Commented:
Hi,

Try specifically including the EditMessageargument:
This one works for A2003 but not for A2007.

So at least we/re getting closer to solve it-:)

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Can you show the SendObject line that works in 2003 now?
0
bfuchsAuthor Commented:
@Scott,

At the moment I'm confused..

Originally it didnt work at my pc either, then you suggested the EditMessageargument and it worked at my pc A2003. (So I got all exsited!!!-:)

Then I tested in A2007 and didnt work.

So I went back to my pc and now it works regardless if I include the EditMessageargument or not..

The acSendNoObject didnt seem to make any difference.

Thanks,
Ben
0
bfuchsAuthor Commented:
Hi Experts,

So where do we stand with this, is there any hope?

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
There have been reports of troubles with SendObject after updating Windows 10 (if you're running Windows 10). Can you check the OS versions on your machines?

See this question on EE for links to some other question about the same thing:

https://www.experts-exchange.com/questions/29076790/Can-anyone-tell-me-why-this-code-in-Access-2010-won't-run-and-how-to-fix-it-after-Win10Pro-1709-fall-creators-update.html
0
bfuchsAuthor Commented:
Hi,

We didnt update any OS, only the office version was upgraded to 2016 (as mentioned, all besides Access).
Most of our users have Win7 Pro.

It sounds like the Outlook Automation mentioned in that other post does work here, however its seems like very complicate code..is there any simple alternative?

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You could use something simple as this:

Sub SendEmail()
    Dim objOL  As Object
    Set objOL = CreateObject("Outlook.Application")
    
    Dim email  As Object
    Set email = objOL.CreateItem(0)    '0 = olItemEmail
    
    With email
        .To = "someone@somewhere.com"
        .Subject = "Test email"
        .Body = "This is a test email"
        .display  'use .Send to send the email immediately
    End With
End Sub

Open in new window

You'd probably want to flesh that out a bit and include error handling, attachments, etc. This also uses Late Binding, so you don't have to be concerned with versioning and such on the target machines.
0

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
bfuchsAuthor Commented:
Hi Scott,

Finally this seems like what I was waiting..
Just waiting for user to test and confirm.

Thanks,
Ben
0
bfuchsAuthor Commented:
Hi Scott,

This is working fine!

Just one question.
Is it possible to have it open by default as HTML message?
Tried changing .Body to .HTMLBody but that didn't do the trick.

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You also have to set the BodyFormat property:

.BodyFormat = olFormatHTML

The value of olFormatHTML is 2, so to use this with Late Binding:

.BodyFormat = 2

Of course, it's not much use if you don't actually have any HTML-formatted text ...
0
bfuchsAuthor Commented:
Thank you very much!!
0
bfuchsAuthor Commented:
Hi,

I need it to have users start typing in HTML format when msg opens up.
see attached1 how it currently looks (included BodyFormat = 2)
And see attached2 how I want it to open.

Thanks,
Ben
Untitled.png
Untitled.png
0
bfuchsAuthor Commented:
Hi,

Of course, it's not much use if you don't actually have any HTML-formatted text ...
Not really, in plain text format you cant play anything with text not even change fonts, make bold etc..
Besides the default format of outlook is HTML when you start new message.
This is probably what gets user's annoyed, when outlook gets open thru Access..

Thanks,
Ben
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Hi Ben,

I'd suggest you open a new question for this.
0
bfuchsAuthor Commented:
Hi,

OK I will

Thanks,
Ben
0
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.