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
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
This problem occurs because the RefreshLink
method ignores the table relationships that are created during the previous call to the method.
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:
- 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)
Set td = CurrentDb.TableDefs(CurrentDb.Relations(i).Table)
If Err.Number = 3265 Then
- In the source code where the RefreshLink method is called, insert the following code immediately before the RefreshLink source code line:
Note "WSSLink" is the name of the linked table that is being refreshed by the RefreshLink method.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Article ID: 926526 - Last Review: October 15, 2007 - Revision: 1.2
- Microsoft Office Access 2007
|kbtshoot kbbug kbprogramming kbtable kbcode kbdao kbvba kbexpertiseinter KB926526|