Office中国论坛/Access中国论坛

标题: 这段odbc的刷新代码怎样用,谢谢! [打印本页]

作者: zwu009    时间: 2005-8-22 17:05
标题: 这段odbc的刷新代码怎样用,谢谢!
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 & "WD=" & b & ";WSID=;DATABASE=" & d & ";Network=DBMSSOCN"

'

            tbl.Attributes = dbAttachSavePWD

            tbl.RefreshLink

        End If

    Next





End Function





[此贴子已经被作者于2005-8-22 10:08:15编辑过]


作者: secowu    时间: 2005-8-22 22:28
Call




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3