Yussi Ariefiyono
Access link table from different database with vba
Problem:
you have lots of database with link table in it, and in one time some of path are changed.. rather than change them manually, i create function that can do that for me
Solution:
In this function you can specify the link you want to find and replace it with your new link. it save me lots of time..
Function RelinkTable(setDB As String, FINDtext As String, REPLACEtext As String)Dim dbs As DatabaseDim Tdf As TableDefDim Tdfs As TableDefsSet dbs = OpenDatabase(setDB)Set Tdfs = dbs.TableDefs‘Loop through the tables collectionFor Each Tdf In TdfsIf Tdf.SourceTableName <> “” And Tdf.Connect = “;DATABASE=” & FINDtext Then ‘if its the linktableTdf.Connect = “;DATABASE=” & REPLACEtext ‘Set the new sourceTdf.RefreshLink ‘Refresh the linkEnd IfNext ‘Goto next tableSet dbs = NothingSet Tdfs = NothingEnd Function
| Print article | This entry was posted by yussi ariefiyono on April 8, 2010 at 7:10 am, and is filed under vba. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |