【发布时间】:2020-07-06 06:46:28
【问题描述】:
我使用 Access 2016 并尝试锁定/解锁每条记录中的字段(Epileptic_activity、Quantifiable_activity 和 Seizure_aspect),当“选择”分别=否/是时(我在选择中选择是/否)。所有这些都发生在大导航表单的子表单中。
我用了这个方法 Enabling/disabling input into certain fields based on the value of another field 它可以工作,但它会锁定/解锁表单中显示的所有数据。 一旦我将任何选择选中为是,所有记录都已解锁 Epileptic_activity、Quantifiable_activity 和 Seizure_aspect。
这是我使用的代码:
Private Sub Selection_AfterUpdate()
Me.Epileptic_activity.Enabled = True
Me.Quantifiable_activity.Enabled = True
Me.Seizure_aspect.Enabled = True
If (Me.Selection = False) Then
Me.Epileptic_activity.Enabled = False
Me.Quantifiable_activity.Enabled = False
Me.Seizure_aspect.Enabled = False
End If
End Sub
所以,我希望能够在选择记录之后锁定/解锁字段,因为在一条记录中我们可以有选择并且以下字段是必需的,但下一条记录没有选择=“是”并且那么我希望锁定以下 3 个字段。
我怎样才能让它工作?
感谢任何帮助
【问题讨论】:
标签: vba ms-access ms-access-2016