【问题标题】:How to limit the "add new record" behaviour to only one field in a MS Access continuous form?如何将“添加新记录”行为限制为 MS Access 连续表单中的一个字段?
【发布时间】:2014-01-21 19:00:12
【问题描述】:

不确定这是否可能。

我有一个带有“连续表单”子表单的 MS Access 表单,其中显示大约 10 个字段
(组合框、文本框和复选框)。

允许添加设置为是。
记录选择器设置为否。

当前表单的行为是,要添加新行,用户只需更新任何可用字段即可。
是否可以将此“添加新记录”行为限制为仅在一个指定字段中发生

【问题讨论】:

    标签: ms-access ms-access-2010


    【解决方案1】:

    您可以使用如下代码:

    Private Sub Form_Current()
        If Me.NewRecord Then
            Me.ControlNameHere.Enabled = False
        Else
            'Do you mean that once a record has been added, the
            'user can update any field? If not, why not just disable 
            'fields that are protected? Otherwise
             Me.ControlNameHere.Enabled = True
        End If
    End Sub
    

    【讨论】:

    • 好的,谢谢。这就像一个魅力!我现在实际上使用它: If Me.NewRecord Then Me.ControlNameHere.Enabled = False else Me.ControlNameHere.Enabled = True end if 并且对于我想要锁定/禁用的所有字段,直到记录真的已添加
    猜你喜欢
    • 1970-01-01
    • 2011-04-28
    • 1970-01-01
    • 1970-01-01
    • 2016-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多