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

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

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

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

        

Access獲取表中字段的標(biāo)題屬性

2018-01-02 17:12:00
tmtony8
原創(chuàng)
10145

在Access中,我們說(shuō)過(guò)表字段名和表字段的標(biāo)題屬性的區(qū)別?!?a href="/article/388.html">ACCESS表字段中字段名,標(biāo)題和說(shuō)明的區(qū)別》

標(biāo)題屬性往往能直接顯示該字段的具體含義。所以如何通過(guò)表字段去獲取該字段的標(biāo)題呢?


如表“表1”中,或者字段“toolname”的標(biāo)題名“工具”


利用DAO自定義一個(gè)獲取字段標(biāo)題的函數(shù)

Public Function GetfldCaption(tblName As String, fldName As String)
    On Error Resume Next
    Dim rs As DAO.Recordset
    Set rs = CurrentDb().OpenRecordset(tblName)
    GetfldCaption = rs(fldName).Properties("Caption")
    rs.Close
    Set rs = Nothing
End Function


窗體調(diào)用該函數(shù)
Me.Label0.Caption = "表1的字段“toolname”的標(biāo)題名是 " & GetfldCaption("表1", "toolname")


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