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作者: 大頭 时间: 2003-11-18 07:41
http://www.erpbus.net/access/topic.asp?topic_id=9648&forum_id=84作者: Eric666 时间: 2003-11-18 21:08
感谢guoya和大头的回复。
请问guoya,程序我试过,好象不行,请问如何断开连接及自动连接,可不可以将文件传给我,非常感谢!
大头,也请你帮帮忙解决此类问题由于水平有限,你的程序我要慢慢看才明白,请帮帮忙解决我的这个问题,再次感谢!
我的邮箱是:eric_zyw@126.com