【问题标题】:What System Table Contains All the Control Properties of a Form in MS Access?什么系统表包含 MS Access 中窗体的所有控件属性?
【发布时间】:2015-11-24 02:02:29
【问题描述】:

如果有办法,我需要直接从系统表中获取控件属性。在 MSysNavPaneObjectIDs 系统表上,我可以获得我的表单名称和它的 ID,但是,这个表单的控件没有任何属性。如何从系统表中获取它?

提前致谢。

【问题讨论】:

    标签: ms-access vba


    【解决方案1】:

    没有系统表可以查看窗体的控件属性。您只能查看那些使用 VBA 的。例如:

    Sub Test()
        Dim formName As String
        Dim frm As Form
        Dim ctrl As Control
        Dim prop As Property
    
        formName = "frmMain"
        Set frm = Forms(formName)
        For Each ctrl In frm.Controls
            Debug.Print ctrl.Name
            For Each prop In ctrl.Properties
                Debug.Print vbTab & prop.Name
            Next
        Next
    End Sub
    

    【讨论】:

    • hello mdialogo,我必须避免使用这个循环,因为我需要在打开表单之前获取控件属性。我可以将控件对象保存在表格中吗?
    • @MyThorRJ 您可以使用 CurrentDb.Execute 命令(而不是对象本身)将控件和属性名称保存在表中。例如,您可以将上面的第二个 Debug.Print 替换为 CurrentDb.Execute "INSERT INTO FormControls (ControlName, PropertyName) VALUES (ctrl.Name, prop.Name)"
    • 保存控件名称的问题是当我需要进行更改时。我也得换桌子。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-15
    • 2012-10-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多