简体   繁体   English

在Access 2007/2010中启用和禁用连续子窗体上的控件

[英]Enabling and disabling controls on a Continuous Subform in Access 2007/2010

I need to enable or disable a control on a continuous subform, dependent on another field. 我需要启用或禁用连续子窗体上的控件,这取决于另一个字段。 The initial code I wrote by instinct was very similar to what is suggested here , but instead of only disabling those controls which are marked as "child", it disables all of them - in effect, it seems only to be looking for the value of the last record and affecting all the rows. 我本能编写的初始代码与此处的建议非常相似,但不是仅禁用那些标记为“child”的控件,而是禁用所有这些 - 实际上,它似乎只是寻找值最后一条记录并影响所有行。

Is there a way this can be achieved, or am I barking up the wrong tree? 有没有办法实现这一目标,还是我咆哮着错误的树? Code below: 代码如下:

If Me.Record_Type = "Child" Then 'Disable subsidiary records
Me.Record_Type.SetFocus
Me.Prospect_Name.Enabled = False
End If

The only way of sensibly working with rows in a continuous form is with Conditional Formatting . 以连续形式合理处理行的唯一方法是使用条件格式 Any code applied refers to the active row, and so it appears to affect all rows. 应用的任何代码都指向活动行,因此它似乎会影响所有行。

Conditional Formatting, Access 2010 条件格式,Access 2010

Enable / Disable is selected 选择启用/禁用

条件格式,Access 2010

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM