I use a utility database and the following code to link from an
original backend to a temporary backend, in order to replace the
original with a newer version:
Dim dbs As Database
Dim tdf As TableDef
Dim Tdfs As TableDefs
Dim Pathname As String
Set dbs = CurrentDb
Set Tdfs = dbs.TableDefs
'LINKING TO THE ORIGINAL BACKEND
Pathname = "C:\Access97\fpsdata.mdb"
For Each tdf In Tdfs
On Error Resume Next
If tdf.SourceTableName <> "" Then
tdf.Connect = ";DATABASE=" & Pathname
tdf.RefreshLink 'Refresh the link
End If
Next 'Goto next table
'LINKING TO A TEMPORARY BACKEND:
Pathname = "C:\Transfer\fpsdata.mdb"
For Each tdf In Tdfs
On Error Resume Next
If tdf.SourceTableName <> "" Then
tdf.Connect = ";DATABASE=" & Pathname
tdf.RefreshLink 'Refresh the link
End If
Next 'Goto next table
'ATTEMPTING TO REPLACE THE FIRST BACKEND WITH ANOTHER VERSION:
Filecopy "C:\NewVersion\fpsdata.mdb, "C:\Access97\fpsdata.mdb"
-- THE FILECOPY ACTION FAILS TO REPLACE C:\Access97\fpsdata.mdb. THE
PROBLEM IS THAT THE UTILITY DATABASE I'M IN EVIDENTLY DOES NOT FULLY
RELEASE OR CLOSE C:\ACCESS97\FPSDATA.MDB, EVEN AFTER LINKING TO THE
SECOND DATABASE.
DO I NEED TO SET 'dbs' AND 'Tdfs' TO NOTHING SOMEWHERE ALONG THE WAY
--AND THEN RE-SET THEM PRIOR TO DOING ANOTHER TABLE-LINK?
THANK YOU.
MARK.