Could this be of help ?
Public Sub AttachLocalDatabase(strDataFile As String)
';(re)attach the tables of the current database to the same location as the current database
Dim strName As String
Dim intPosition As Integer
strName = CurrentDb().Name
intPosition = ReverseInstr(strName, "\"

RefreshAttachments Left$(strName, intPosition) & strDataFile, strDataFile
End Sub
Private Function ReverseInstr(strSource As String, strPattern As String) As Integer
Dim intLength, intPos, intStart As Integer
On Error Resume Next
intLength = Len(strSource)
intStart = intLength - Len(strPattern)
intPos = 0
Do While intPos = 0 And intStart > 0
intPos = InStr(intStart, strSource, strPattern)
intStart = intStart - 1
Loop
ReverseInstr = IIf(IsNull(intPos), 0, intPos)
End Function
Private Function RefreshAttachments(strDbPath As String, strDb As String) As Integer
'; RefreshAttachments returns true if all attachments have been succesfully refreshed
On Error GoTo RefreshAttachments_Err
Dim Ws As Workspace
Dim Db As Database
Dim i As Integer
Dim J As Integer
RefreshAttachments = True
Set Ws = DBEngine.Workspaces(0)
For J = 0 To Ws.Databases.Count - 1
Set Db = Ws.Databases(J)
For i = 0 To Db.TableDefs.Count - 1
If Len(Db.TableDefs(i).Connect) > 0 Then
If ysnForceRefresh Then
If InStr(Db.TableDefs(i).Connect, strDb) > 0 Then
Db.TableDefs(i).Connect = ";DATABASE=" & strDbPath
Db.TableDefs(i).RefreshLink
Db.TableDefs.Refresh
End If
Else
If InStr(Db.TableDefs(i).Connect, strDb) > 0 Then
If Db.TableDefs(i).Connect <> ";DATABASE=" & strDbPath Then
Db.TableDefs(i).Connect = ";DATABASE=" & strDbPath
Db.TableDefs(i).RefreshLink
Db.TableDefs.Refresh
End If
End If
End If
End If
Next i
Next J
Db.Close
Set Db = Nothing
Set Ws = Nothing
Exit Function
RefreshAttachments_Err:
RefreshAttachments = False
Debug.Print "RefreshAttachments: " & Err & ", " & Error
Resume Next
End Function