Error message when you try to open a linked SharePoint table in Access 2007: "The Microsoft Office Access database engine could not find the object"

Article translations Article translations
Article ID: 926526 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

When you try to open a linked Microsoft Windows SharePoint Services table in Microsoft Office Access 2007, you may receive an error message that resembles the following error message:
The Microsoft Office Access database engine could not find the object 'Object name'. Make sure the object exists and that you spell its name and the path name correctly.
However, the linked SharePoint table opens successfully.

This error message occurs after you update the linked SharePoint table programmatically more than one time in a row by using the Data Access Objects (DAO) RefreshLink method.

CAUSE

This problem occurs because the RefreshLink method ignores the table relationships that are created during the previous call to the method.

WORKAROUND

To work around this problem, programmatically delete the table relationships before you use the RefreshLink method to update the linked table.

Sample subroutine to delete the relationships

To use a subroutine to delete the relationships for the refreshed link, follow these steps:
  1. Insert the following code into a module in Microsoft Visual Basic for Applications (VBA):
    Public Sub RemoveInvalidRelationships(strTableName As String)
        On Error Resume Next
        Dim cnt As Integer
        Dim i As Integer
        Dim bForeignTable As Boolean
        Dim bTable As Boolean
        Dim td As TableDef
        
        cnt = CurrentDb.Relations.Count - 1
        ' Go through the relationships collection backwards, to ensure that if we delete one, we will have a valid index
        For i = cnt To 0 Step -1
            bTable = False
            bForeignTable = False
            If (StrComp(CurrentDb.Relations(i).Table, strTableName, vbTextCompare) = 0) Then bTable = True
            If (StrComp(CurrentDb.Relations(i).ForeignTable, strTableName, vbTextCompare) = 0) Then bForeignTable = True
            
            If bTable Xor bForeignTable Then
                ' Determine if either the table or foreign table is the table that we are interested in
                ' We will then look at the other table to determine if it exists
                ' If it doesn't exist, delete the relationship
                If bTable Then
                    Set td = CurrentDb.TableDefs(CurrentDb.Relations(i).ForeignTable)
                Else
                    Set td = CurrentDb.TableDefs(CurrentDb.Relations(i).Table)
                End If
                
                If Err.Number = 3265 Then
                    CurrentDb.Relations.Delete CurrentDb.Relations(i).Name
                End If
                Err.Clear
            End If
            
        Next i
    End Sub
    
  2. In the source code where the RefreshLink method is called, insert the following code immediately before the RefreshLink source code line:
    RemoveInvalidRelationships "WSSLink"
    Note "WSSLink" is the name of the linked table that is being refreshed by the RefreshLink method.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Properties

Article ID: 926526 - Last Review: October 15, 2007 - Revision: 1.2
APPLIES TO
  • Microsoft Office Access 2007
Keywords: 
kbtshoot kbbug kbprogramming kbtable kbcode kbdao kbvba kbexpertiseinter KB926526

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com