Results 1 to 6 of 6
  1. #1
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69

    Trouble editing a linked Outlook Contact list

    I have an Outlook Contact as an External Data linked table. I have a form that displays a listbox with names in one column and email addresses in another. For mail recipients not in the contact list I have two textboxes...One for the recipients name and another for the email address. I then have a button that concatenates an email string in the format that outlook uses. after formatting is completed I pop a messagebox offering to add the contact to outlook using the following code.



    Code:
    Private Sub AddToOutlook(Name As String, eMail As String)
    
    
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim firstName As String
    Dim lastName As String
    
    
    Set db = Application.CurrentDb
    Set rs = db.OpenRecordset("OutlookContacts", dbOpenDynaset)
    
    
        firstName = Split(Name, " ")(0) 'get the element before the space
        lastName = Split(Name, " ")(1) 'get the element after the space
            
            With rs
                .AddNew
                ![Display name] = Name
                ![E-mail address] = eMail
                ![First] = firstName
                ![Last] = lastName
                .Update
                .Close
            End With
        Me.Requery
    End Sub
    It all seems straightforward enough but when the code is run I get the following dialog telling me I do not have the proper permissions.
    Click image for larger version. 

Name:	Screenshot 2024-01-12 233807.png 
Views:	13 
Size:	9.3 KB 
ID:	51323

    Here is the form


    Click image for larger version. 

Name:	Screenshot 2024-01-12 234711.png 
Views:	13 
Size:	23.5 KB 
ID:	51324

    Any idea of what kind of permissions are needed to edit a linked Outlook table?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Google is always my first point of call?
    https://www.google.com/search?q=outl...hrome&ie=UTF-8


    I would expect permissions be due to Excahnge Server?, is that the case with you?

    Also Name is a reserved word, and if you are just adding records, better to open a empty recordset. There is actually a parameter to indicate this, but I cannot remember what it is. Amother way is to use criteria to return an empty set like WHERE 1 = 0.

    Found it. https://learn.microsoft.com/en-us/of...numeration-dao
    Last edited by Welshgasman; 01-13-2024 at 07:29 AM.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    Quote Originally Posted by Welshgasman View Post
    Google is always my first point of call?
    https://www.google.com/search?q=outl...hrome&ie=UTF-8


    I would expect permissions be due to Excahnge Server?, is that the case with you?

    Also Name is a reserved word, and if you are just adding records, better to open a empty recordset. There is actually a parameter to indicate this, but I cannot remember what it is. Amother way is to use criteria to return an empty set like WHERE 1 = 0.

    Found it. https://learn.microsoft.com/en-us/of...numeration-dao
    Weslhgasman,

    Thanks for the links on enumeration options. However I cannot even edit this table as a datasheet. I have tried deleting the link, going to Outlook, setting all permissions to "Owner", and relinking with no change in the outcome. Crazy because I watched a ew videos on this and in all of the tutorials they create the link and have no issues with permissions. They are able to edit straight away after creating the link. Oh, yes, I have searched a lot on this and have not yet found a resolution.

  4. #4
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    OK Folks,

    I found a work around that will likely work for me. It's not quite what I wanted but it works just fine. I found some posts elsewhere with some code for manipulating the Outlook object and with some minor modifications for my application I came up with the following.

    Code:
    Private Sub AddToOutlook(strName As String, strEmail As String)
    Dim strFirstName As String
    Dim strLastName As String
    Dim objOutlook As Outlook.Application
    Dim objContact As Outlook.ContactItem
    Dim Item As Outlook.ContactItem
    
    
        strFirstName = Split(strName, " ")(0) 'get the element before the space
        strLastName = Split(strName, " ")(1) 'get the element after the space
    
    
    
    
        'InitOutlook
        Set objOutlook = CreateObject("Outlook.application")
        Set Item = objOutlook.CreateItem(olContactItem)
        
        Item.FirstName = strFirstName & ""
        Item.LastName = strLastName & ""
        Item.Email1Address = strEmail & ""
        Item.Display
        
        Set objOutlook = Nothing
        Set Item = Nothing
    
    
    End Sub
    When the code completes it opens in Outlook as a contact card in "General" view. This is not altogether bad as it allows the user to add additional information if they so choose and my linked table still works fine in read only for populating the listbox with email adresses and contact names.

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    I do not know what to say.
    I linked to my outlook contacts and was able to amend just opening the table.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    Quote Originally Posted by Welshgasman View Post
    I do not know what to say.
    I linked to my outlook contacts and was able to amend just opening the table.
    Yes I know, that is why I was baffled. Some searches did reveal others experiencing similar issues but no solutions.

    Interestingly I opened the db on my laptop which is mirrored through OneDrive and as expected the same issue there even though I was secretly hoping it was a local problem.

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

Similar Threads

  1. Add Contact From Outlook
    By PaulMoor in forum Macros
    Replies: 0
    Last Post: 04-19-2020, 11:23 AM
  2. Creating Outlook Contact - Error Msg
    By iDeals in forum Modules
    Replies: 4
    Last Post: 10-06-2015, 07:41 AM
  3. Add Contact from Outlook in a Subform
    By rapaint66 in forum Access
    Replies: 3
    Last Post: 08-29-2014, 09:37 AM
  4. Replies: 3
    Last Post: 10-19-2013, 10:21 AM
  5. add to Outlook Contact
    By sdel_nevo in forum Programming
    Replies: 2
    Last Post: 06-10-2013, 01:07 AM

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