office交流網(wǎng)--QQ交流群號及微信交流群

Access培訓群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

微信交流群(請用微信掃碼)

        

穫取Access所有鏈接錶的名稱

2003-09-21 05:29:00
竹笛-Office交流網(wǎng)
原創(chuàng)
4795

問題(網(wǎng)友:eio)

穫取Access所有鏈接錶的名稱 ,最好不顯示本地錶的名稱


解決辦法(竹笛):


Function fGetLinkPath(strTable As String) As String
Dim dbs As Database, stPath As String

    Set dbs = CurrentDb()
    On Error Resume Next
    stPath = dbs.TableDefs(strTable).Connect
    If stPath = "" Then
        fGetLinkPath = vbNullString
        'can change this to currentdb.name
    Else
        fGetLinkPath = right(stPath, Len(stPath) _
                        - (InStr(1, stPath, "DATABASE=") + 8))
    End If
    Set dbs = Nothing
End Function

Sub sListPath()
    Dim loTd As TableDef
    CurrentDb.TableDefs.Refresh
    For Each loTd In CurrentDb.TableDefs
        Debug.Print fGetLinkPath(loTd.Name)
    Next loTd
    Set loTd = Nothing
End Sub


(DAO_鏈接錶_ODBC-相關文章技巧鏈接):
如何用代碼鏈接帶有密碼的數(shù)據(jù)庫中的錶
ACCESS使用鏈接錶共享數(shù)據(jù)庫的安全性案例探討
自動更新鏈接錶的模塊
徹底隱藏所有的基本錶包括鏈接錶及繫統(tǒng)錶函數(shù)
分享
聯(lián)繫我們
聯(lián)繫人: 王先生
Email: 18449932@qq.com
QQ: 18449932
微博: officecn01
移動訪問