在用MDB与SQL SEVER2000链接时,有时需要刷新链接表,通过以下代码可以达到目的,
此主题的解决参考了网友cwang的代码,并得到了微软工程师Billy Yao 的热心帮助,在此致谢!
Function relink()
Dim db As Database
Dim tbl As TableDef
Dim a As String
Dim b As String
Dim d As String
a = "sa"'数据库用户
b = "abc"'数据库口令
d = "abcde"'数据库名称
Set db = CurrentDb
For Each tbl In db.TableDefs
If tbl.Attributes = 536870912 Then
tbl.Connect = "FILEDSN=d:/demo/steel.dsn;UID=" & a & ";PWD=" & b & ";WSID=;DATABASE=" & d & ";Net...[ 查看全文 ]