Function fResetLinks() ' Cycles through all linked tables in an Access database and alters the links Dim DB As Database Dim daoOldTable As DAO.TableDef Dim i As Integer Dim strName As String Dim DBName As String Dim DSNname As String DSNname = "foo" DBName = "database" Set DB = CurrentDb() For i = 0 To CurrentDb.TableDefs.Count - 1 Set daoOldTable = DB.TableDefs(i) With daoOldTable If Not daoOldTable.Connect = "" Then ' only for linked tables! Debug.Print daoOldTable.Connect ' Using this line causes Access/MyODBC to eat one port per action daoOldTable.Connect = "ODBC;DSN=" & DSNname ' assumes DB name in DSN ' Using this line works fine with Access/MyODBC ' daoOldTable.Connect = "ODBC;DSN=" & DSNname & ";DATABASE=" & DBName daoOldTable.RefreshLink End If End With Next i Set daoOldTable = Nothing CurrentDb.TableDefs.Refresh End Function