Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Is there any code to relink Sharepoint tables

Is there any code to relink Sharepoint tables

Is there any code to relink Sharepoint tables

Is there any code that will re-link tables. We link to Sharepoint tables, and my manager says the links need
to be refreshed because he noticed the database is not in sync with Sharepoint. So, is there any code that
can do this because i dont want to do this manually.

RE: Is there any code to relink Sharepoint tables


Sub RefreshSharePointLinks()
  DoCmd.Hourglass True
   Dim dbs As Database
   Dim tbl As TableDef
   Dim SQL As String
   Dim rst As DAO.Recordset
   Set dbs = CurrentDb()
   For Each tbl In dbs.TableDefs
      If (Mid(tbl.Name, 1, 1) <> "~") And ((tbl.Attributes And dbAttachedTable) = dbAttachedTable) Then
         If Left(tbl.Name, 21) <> "User Information List" Then
            If Left(tbl.Connect, 3) = "WSS" Then
               SQL = "SELECT * FROM [" & tbl.Name & "];"
               Set rst = dbs.OpenRecordset(SQL, dbOpenDynaset)
               If Not rst.Updatable Then
                  DoCmd.SelectObject acTable, tbl.Name, True
                  DoCmd.RunCommand acCmdRefreshSharePointList
               End If
            End If
         End If
      End If
   DoCmd.Hourglass False
End Sub 

RE: Is there any code to relink Sharepoint tables

Thank you for the code. Is it possible that Jet will lose the linkage to the Sharepoint tables.
We are not seeing values in our linked tables that are in the Sharepoint table.
Why would this happen?

RE: Is there any code to relink Sharepoint tables

I think the answer is yes. I know that I would routinely show the tables connected, but no data. Then I would "relink". I run this code in a hidden startup form when the db opens and that has solved the problem.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close