Ive the code below in my front end application.
When I run the code though, it doesnt update the tdf for each table in the database. So what am I doing wrong?
Cheers
K
When I run the code though, it doesnt update the tdf for each table in the database. So what am I doing wrong?
Cheers
K
Code:
Private Sub LinkTables(strTable As String, strDb As String)
Const LINKEDALREADY As Integer = 3012
Dim tdf As New TableDef
On Error GoTo Err_LinkTable
'--Create new TableDef def
Set tdf = CurrentDb.CreateTableDef() '(strTable)
tdf.Connect = ";DATABASE=" & strDb
tdf.SourceTableName = strTable
CurrentDb.TableDefs.Append tdf
Exit_LinkTable:
Exit Sub
Err_LinkTable:
If Err.Number = LINKEDALREADY Then 'do nothing
Resume Exit_LinkTable
Else
'-- Handle error
End If
End Sub