Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code Not Updating Table Links

Status
Not open for further replies.

Kalisto

Programmer
Feb 18, 2003
997
GB
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

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top