nikademous
Technical User
Hello, I have a update utility that moves files (tables, forms and module) into a chosen front end and back end. What im trying to do from this utility is link the that BE(s) tables to the FE that I chose. I cant get it right, I get down to the second Debug.Print strTblName and it gives me the correct names of the tables in the BE but wont update them to the front end.
strBEFile and strFEFile are the full paths of the BE and FE that was selected to link tables.
strBEFile and strFEFile are the full paths of the BE and FE that was selected to link tables.
Code:
Dim dbs, dbs1 As DAO.Database
Dim tdf, tdf1 As TableDef
Dim strFEFile, strBEFile, strTblName As String
strBEFile = Me.txtBackEnd
strFEFile = Me.txtFEMaster
Set dbs = DBEngine.Workspaces(0).OpenDatabase(strBEFile)
Set dbs1 = DBEngine.Workspaces(0).OpenDatabase(strFEFile)
On Error Resume Next
For Each tdf1 In dbs1.TableDefs
strTblName = tdf1.Name
'Debug.Print strTblName
If Left(strTblName, 4) <> "msys" Then
dbs.TableDefs.Delete strTblName
'Debug.Print strTblName
Set tdf = CurrentDb.CreateTableDef(strTblName)
tdf.Connect = ";DATABASE=" & strBEFile
tdf.SourceTableName = strTblName
CurrentDb.TableDefs.Append tdf
End If
Next tdf1
Set dbs1 = Nothing
Set dbs = Nothing