用mdb通过ODBC链接SQL数据库,可以通过如下代码刷新连接:
Dim db As Database
Dim tbl As TableDef
Set db = CurrentDb
For Each tbl In db.TableDefs
If tbl.Attributes = 536870912 Then
tbl.Connect = "DSN=gdts;UID=" & a & "WD=" & b & ";WSID=;DATABASE=" & d & ";Network=DBMSSOCN"
tbl.RefreshLink
End If
Next