Results 1 to 4 of 4
  1. #1
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Can no longer send email through Access since upgrade to 2016


    Hello!

    I was previously able to use this code successfully to send a single or group email to chosen contacts:
    Code:
    Dim db As DAO.Database
    Dim MailList As DAO.Recordset
    Dim MyOutlook As Outlook.Application
    Dim MyMail As Outlook.MailItem
    Dim Subjectline As String
    Dim BodyFile As String
    Dim MyBody As String
    Dim MyBodyText As String
    
    
    On Error GoTo ErrorHandler
    
       Dim strBCC As String
       
       Set lst = Me![lstSelectContacts]
       'Check that at least one contact has been selected
       If lst.ItemsSelected.Count = 0 Then
          MsgBox "Please select at least one contact"
          lst.SetFocus
          GoTo ErrorHandlerExit
       End If
       
       'Test for required fields
       'strTo = Me![txtTo].Value
       'If strTo = "" Then
       '   strTo = "someone@microsoft.com"
       'End If
       
       strSubject = Me![txtSubject].Value
       If strSubject = "" Then
          MsgBox "Please enter a subject"
          Me![txtSubject].SetFocus
          GoTo ErrorHandlerExit
       End If
       
       strBody = Me![txtBody].Value
       If strBody = "" Then
          MsgBox "Please enter a message body"
          Me![txtBody].SetFocus
          GoTo ErrorHandlerExit
       End If
       
       'Add contacts to variable for BCC field
       
       For Each varItem In lst.ItemsSelected
          'Check for email address
          strEMailRecipient = Nz(lst.Column(1, varItem))
    '      Debug.Print "EMail address: " & strEMailRecipient
          If strEMailRecipient <> "" Then
             strBCC = strBCC & strEMailRecipient & ";"
          End If
       
       Next varItem
       
       strBCC = Left(strBCC, Len(strBCC) - 1)
       
       'Create new mail message and send to contacts
       Set msg = appOutlook.CreateItem(olMailItem)
       With msg
          '.To = strTo
          .Subject = strSubject
          .Body = strBody
          .BCC = strBCC
          .Display
          .Send
       End With
       MsgBox "Emails have been sent"
    
    
    ErrorHandlerExit:
       Exit Sub
    
    ErrorHandler:
       MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
       Resume ErrorHandlerExit
    But since upgrading to 2016 (Office 365), I get the error: "You don't have permission to create an entry in this folder. Right-click the folder, and then click Properties to check your permissions for the folder. etc." I have made sure the folder Office16 allows full control for all users (I'm the only user on my computer). Not sure where else to look. Suggestions greatly appreciated as always.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,399
    if you have upgraded - are you now using the right outlook library in VBA references? And in upgrading are you still using 64bit access or have you reverted to 32bit

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    IIRC Office 365 uses Exchange Server Online. You are probably not connecting to a pst file.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I was able to test an Exchange Online account using Outlook 2013. This is a desktop version. So, my version of Office is not part of the 365 thing.

    I was able to automate it and everything worked fine. I checked my Outlook account settings and I have the Cached Exchange Mode Settings enabled.

    By the way, do you have more than one Email Account on your Outlook application? Maybe your code is defaulting to an inactive account.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-23-2016, 01:28 PM
  2. Replies: 4
    Last Post: 06-26-2015, 10:31 AM
  3. Replies: 5
    Last Post: 04-25-2013, 10:36 AM
  4. How can I send an email from access???
    By Asma in forum Programming
    Replies: 2
    Last Post: 12-07-2011, 07:49 AM
  5. VBA to Send email from Access
    By ped in forum Access
    Replies: 3
    Last Post: 08-11-2011, 05:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums