Search Tools Links Login

Access Linked Table Path Correction

Posted: 2003-06-01
By: ArchiveBot
Viewed: 58

Filed Under:

VB6 Code Cache

No attachments for this post

When the folder of an access application and its linked table source changes, this code will modify the linked tables to comply.

Original Author: Yalin Meric


In order that code to work the Access application and the linked table source file must be in the same directory. Also the user running the application must have the permission to modify the tables.


Sub TabloLinkleriniKontrolEt(sSourceFile As String)
Dim daTaban As Database, tbTablo As TableDef
Set daTaban = CurrentDb
For Each tbTablo In daTaban.TableDefs
If InStr(tbTablo.Connect, "DATABASE=") > 0 Then
  Debug.Print tbTablo.Connect
  If tbTablo.Connect <> ";DATABASE=" & Application.CurrentProject.Path & "" & sSourceFile Then
  tbTablo.Connect = ";DATABASE=" & Application.CurrentProject.Path & "" & sSourceFile
  End If
End If
End Sub

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.