valjah
Programmer
- Aug 1, 2005
- 11
Can someone please help me with this problme. Thanks in advance. My ReattachTables routine works to reattach the tables if the database is stored locally on my computer. However, if the database is stored on the network drive say H: the refreshlink does not work, and the tables are not reattached/linked. here is my code:
Function ReattachTables() As Variant
On Error GoTo Reattach_Err
'Restores table attachments, using the specified back-end database
Dim myDB As Database, tmpTable As TableDef
Dim i As Integer
Dim lpDBName As String
Set myDB = DBEngine(0)(0)
lpDBName = "H:\Management\Data\Plus\plusdb.mdb"
For i = 0 To myDB.TableDefs.Count - 1
Set tmpTable = myDB.TableDefs(i)
If tmpTable.Connect <> "" Then
tmpTable.Connect = ";DATABASE=" & lpDBName
tmpTable.RefreshLink
End If
Next i
ReattachTables = True
Reattach_Exit:
Exit Function
Reattach_Err:
MsgBox Error$
Resume Reattach_Exit
End Function
Function ReattachTables() As Variant
On Error GoTo Reattach_Err
'Restores table attachments, using the specified back-end database
Dim myDB As Database, tmpTable As TableDef
Dim i As Integer
Dim lpDBName As String
Set myDB = DBEngine(0)(0)
lpDBName = "H:\Management\Data\Plus\plusdb.mdb"
For i = 0 To myDB.TableDefs.Count - 1
Set tmpTable = myDB.TableDefs(i)
If tmpTable.Connect <> "" Then
tmpTable.Connect = ";DATABASE=" & lpDBName
tmpTable.RefreshLink
End If
Next i
ReattachTables = True
Reattach_Exit:
Exit Function
Reattach_Err:
MsgBox Error$
Resume Reattach_Exit
End Function