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

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

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

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

        

Access讀取其他數(shù)據(jù)庫的表

2019-01-03 16:03:00
tmtony8
原創(chuàng)
3810

在Access中,我們不但可以遍歷讀取自己庫中的表,也可以讀取其他數(shù)據(jù)庫中的表。

獲取Access數(shù)據(jù)表可參閱:《獲取Access數(shù)據(jù)庫中所有表或查詢的方法


如果要讀取D盤的db.accdb數(shù)據(jù)庫中的表呢?


在相關(guān)事件中運行下面的代碼:

 dim strPath as string
strPath =D:\db.accdb
Dim db As Database
Dim tbl As TableDef
Set db = OpenDatabase("" & strPath  & "")
For Each tbl In db.TableDefs
     Debug.Print tbl.Name                        
Next 


獲取結(jié)果如下:

    分享
    文章分類
    聯(lián)系我們
    聯(lián)系人: 王先生
    Email: 18449932@qq.com
    QQ: 18449932
    微博: officecn01
    移動訪問