Enabling and disabling controls on a Continuous Subform in Access 2007/2010
Asked Answered
M

1

6

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.

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
Malacostracan answered 16/7, 2012 at 15:9 Comment(0)
A
12

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

Enable / Disable is selected

Conditional Formatting, Access 2010

Aut answered 16/7, 2012 at 15:10 Comment(4)
Thanks, will check out the link and report back.Malacostracan
Hi Remou - conditional formatting works fine for changing colours and the like, but appears to have no abilities over enabling or disabling the control as I want to - I'm beginning to suspect this is impossible, is this the case?Malacostracan
Hi @OliJeffery The very last option in the row is Enable / Disable. I have just checked for Access 2010, but I remember it from earlier versions. It is a little hard to see.Aut
Aha! Perfect, thanks. I was being a doofus and assumuing that disabled or enabled the rule as opposed to the control.Malacostracan

© 2022 - 2024 — McMap. All rights reserved.