** Any assistance you can provide would be greatly appreciated **
I have a main form with multiple sub-forms. On the main form, I have a
checkbox that corresponds with each sub-form, and this checkbox will
express the users desire to lock the ability to edit a corresponding
sub-form. To do this, I figure that each checkbox will have :
(1) the AfterUpdate property call a Macro or VB Module to execute the
setting of the Allow Edits property of the sub-form and
(2) the On Current or On Load property of each corresponding sub-form
will also check the value of the checkbox in the main form to
determine whether the Allow Edits value for this sub-form should be
Yes or No.
I have a Macro that sets the value for the sub-form and I have plugged
that into the AfterUpdate setting of the checkbox on the main form,
but I cannot find a way to insert a step before the SetValue part
which can evaluate the state of the checkbox and conditionally set the
value of the Allow Edits based on that value. I have also been playing
with the Visual Basic Code Editor my feable attempts are also failing.
Any help or insight you can provide would be helpful.
The VB code I have at the moment (but it is not compiling properly)
is:
Private Sub Locked_AfterUpdate()
If Forms!Form1!Locked = True Then SetValue [Forms]![SubForm1]![Allow
Edits] = No
Else: SetValue [Forms]![SubForm1]![Allow Edits] = Yes
End If
End Sub
** If the form element called Locked is checked, then set the form
property Allow Edits of SubForm1 to No, else set value to Yes.
Again, I appreciate any thoughts or help you can provide to either add
to the macro I have to do that evaluation of the form element value,
or adjust the code so it can be used in both the AfterUpdate property
of the checkbox and either the On Current or On Load properties of
each subform.