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

Access培訓(xùn)群:792054000         Excel免費(fèi)交流群群:686050929          Outlook交流群:221378704    

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

微信交流群(請(qǐng)用微信掃碼)

        

獲取Access所有鏈接表的名稱

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

問(wèn)題(網(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-相關(guān)文章技巧鏈接):
如何用代碼鏈接帶有密碼的數(shù)據(jù)庫(kù)中的表
ACCESS使用鏈接表共享數(shù)據(jù)庫(kù)的安全性案例探討
自動(dòng)更新鏈接表的模塊
徹底隱藏所有的基本表包括鏈接表及系統(tǒng)表函數(shù)
分享
文章分類
聯(lián)系我們
聯(lián)系人: 王先生
Email: 18449932@qq.com
QQ: 18449932
微博: officecn01
移動(dòng)訪問(wèn)