Consulting

Results 1 to 4 of 4

Thread: Relinking Code issue

  1. #1

    Relinking Code issue

    I have a client using of all things DBF files. Now I run the code below and can refresh the links but when I try to change the td.connect by uncommenting it, I get the error the path is invalid. Any ideas?

    Function relinkDBF()
       Dim db As DAO.Database, rs As DAO.Recordset, tds As DAO.TableDefs, td As DAO.TableDef, ErrCount As Integer
        
        Set db = CurrentDb
        Set tds = db.TableDefs
        
    On Error GoTo Err_Proc
        For Each td In tds
        'td.Connect = "dBASE III;HDR=NO;IMEX=2;ACCDB=YES;DATABASE= C:\Users\Sergi.Arthur\Desktop\TJS051622"
        If Right(td.SourceTableName, 3) = "DBF" Then
        Debug.Print Right(td.SourceTableName, 3), td.SourceTableName, td.NAME, td.Connect
        td.RefreshLink
        End If
        Next
    Exit_Proc:
        Exit Function
    Err_Proc:
        Select Case Err.NUMBER
            Case 3011
                ErrCount = ErrCount + 1
                Resume Next
            Case Else
                MsgBox Err.NUMBER & "-" & Err.Description
                Resume Exit_Proc
        End Select
    End Function

  2. #2
    see this link, it need the .Connect property to be filled first before issueing .RefreshLink.
    TableDef.RefreshLink method (DAO) | Microsoft Docs

  3. #3
    Quote Originally Posted by arnelgp View Post
    see this link, it need the .Connect property to be filled first before issueing .RefreshLink.
    TableDef.RefreshLink method (DAO) | Microsoft Docs

    You can see that this is the case from my code.

  4. #4
    Quote Originally Posted by RPFeynman06 View Post
    You can see that this is the case from my code.
    is it? you Comment out the Connect part.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •