Experts Exchange Solution brought to you by
"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.
R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.
DoCmd.SendObject , , , , , , Trim(Me.FirstName & " " & Me.LastName), "Received documents."
Open in new window
Might review the Trusted Locations to ensure the Access db is located in one.
Just for fun, try sending a report with all the major arguments filled in:..
I tested code, like what I suggested above, in 2016 and it worked fine.
(was this same event code working in the previous version?)
This has nothing to do with the file being an ADP.
Just tested with an A2003 MDB and the same is happening there.
Just curious - what happens if you run that code in a .accdb format file with 2016?
I got to test at another pc with Outlook 2016 and it worked with all versions MDB and ACCDB.
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
Also, it could be something entirely different - for example, the version of DAO/JET/ACE on each machine
Try temporarily turning off antivirus to see if that is the culprit (long shot, but ya never know).
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..
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)
.To = sTo
.CC = sCC
.BCC = sBcc
.Subject = sSub
.Body = shtmlBody
' .htmlBody = shtmlBody
' .ReadReceiptRequested = True
Set outApp = Nothing
Set outMsg = Nothing
Try specifically including the EditMessageargument:
Dim objOL As Object
Set objOL = CreateObject("Outlook.Application")
Dim email As Object
Set email = objOL.CreateItem(0) '0 = olItemEmail
.To = "firstname.lastname@example.org"
.Subject = "Test email"
.Body = "This is a test email"
.display 'use .Send to send the email immediately
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Of course, it's not much use if you don't actually have any HTML-formatted text ...
From novice to tech pro — start learning today.
Members can enroll in this course at no extra cost.