'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'2005-08-18 中俄双雄演义日
'By 狠狠活
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub LinkTables(strDatabase As String)
Dim dbs As Database
Dim tdf As TableDef
Dim intI As Integer
Set dbs = CurrentDb
Set tdf = dbs.TableDefs(0)
For intI = 0 To dbs.TableDefs.Count - 1
Set tdf = dbs.TableDefs(intI)
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & strDatabase
tdf.RefreshLink
End If
Next intI
End Sub
'调用方法:
Call LinkTables("C:\MyFolder\Mydb.mdb")
[此贴子已经被作者于2005-8-18 13:33:46编辑过]
|