|
Function checkRefreshLink()
'Dim DB As Database
li = False
'On Error GoTo RefreshLink_Err
CurrentDb.TableDefs.Refresh
c = CurrentProject.Path
If Right(c, 1) <> "\" Then
c = c & "\"
Else
c = c
End If
c1 = c & "data_be.mdb"
If Dir(c1) = "" And Dir(c1, 2) = "" Then
MsgBox "在" & c & "找不到data_be.mdb文件,请确定文件存在,再使用本系统"
'Application.Quit
End If
Set db = CurrentDb
db.TableDefs.Refresh
Set t = CurrentDb.OpenRecordset("LINK_Table")'LINK_Table表中存放连接表名称
Do Until t.EOF
On Error Resume Next
db.TableDefs.Delete t("tbname")
t.MoveNext
Loop
t.MoveFirst
'Set t1 = CurrentDb.OpenRecordset("select * from LinkOK")
Set t3 = DBEngine.Workspaces(0).OpenDatabase(c1, False, False, ";pwd=7212763")
Set t4 = CurrentDb
Do Until t.EOF
Set ntb = t4.CreateTableDef(t("tbName"))
ntb.Connect = ";DATABASE=" & t3.name
ntb.SourceTableName = t("tbName")
t4.TableDefs.Append ntb
ntb.RefreshLink
t.MoveNext
Loop
RefreshLink_Err:
End Function |
|