We have upgraded from 2010 to Access 2016 and my email routine is not working. Getting a runtime error - 2147417851 (800 10105)
Methos ".To' of object - _Mail Item Failed
This is the code I have been using in 2010
The error stops on the .To item in the With statement
I suspect 2016 does this a little differently Not sure what library references I need. I have included the Microsoft Outlook 16.0 Object Library is there anything else?
Any help would be appreciated
atrium
Methos ".To' of object - _Mail Item Failed
This is the code I have been using in 2010
Code:
Public Function SendPDFemail()
Dim strEmail As String
Dim strMsg As String
Dim oLook As Object
Dim oMail As Object
Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.createitem(0)
With oMail
.To = Me.SendToEmailFld '" emailaddress@sample.com.au"
.body = "Dear Sir / Madam" & Chr(10) & Chr(10) & "Please find enclosed a self explanatory communication from The Group." & Chr(10) & Chr(10) & Chr(10) & Chr(10) & "Regards" & Chr(10) & Chr(10) & "The Group"
.Subject = "This is a Communication from The Group for your attention - " & Me.ClientRefNoFld
.Attachments.Add (DocPathFld & PdfFileNameFld)
'********* What is the command to preview instead of send **** .Display *****
.Display
End With
Set oMail = Nothing
Set oLook = Nothing
End Function
The error stops on the .To item in the With statement
I suspect 2016 does this a little differently Not sure what library references I need. I have included the Microsoft Outlook 16.0 Object Library is there anything else?
Any help would be appreciated
atrium