' 用途: 批量去除通过ODBC连接到SQL Server链接表名前的"DBO_"
' 要求引用 Microsoft DAO 3.60 Object Library
' 作者: 朱亦文
Public Sub RenameLinkTableName()
Dim dbs As Database
Dim tdf As TableDef
Dim strNewName As String
Dim strName As String
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
strName = tdf.Name
If Ucase(Left(strName, 3)) = "DBO" Then
strNewName = Right(strName, Len(strName) - 4)
tdf.Name = strNewName
tdf.RefreshLink
End If
Next
End Sub