It sounds like the check box is bound to a column in the form's underlying
table or query; I'd assumed it was unbound. With a bound control call the
check box's AfterUpdate event procedure in the form's Current event
procedure. If the control is called chkLockControls say, then the code to
call the procedure would be:
Me.chkLockControls.SetFocus
chkLockControls_AfterUpdate
This first moves the focus to the check box, and then executes the code in
its AfterUpdate event procedure, so the other controls will be accessible or
not depending on the value of the check box in the current record.
One other thing you should do is cater for the user moving the form to a new
record. Until the user begins to insert data into the new record the check
box will be Null, but to unlock/enable the controls you need a value of
False. So, in the check box's AfterUpdate event procedure change each
occurrence of:
Me.ActiveControl
to:
Nz(Me.ActiveControl,False)
the Nz function will return a value of False if the control is Null,
otherwise it returns the value of the control, which might be True or False.
You would not have to do this if the AfterUpdate event procedure was only
being executed after the control is updated as in the case of a bound control
it can only be updated to True or False, these being the only legitimate
values of a Boolean (Yes/No) data type column, not to Null, but as its now
being called by the form's Current event procedure Null needs to be catered
for.
Ken Sheridan
Stafford, England