Full Version: block edits on a subform - please advise
UtterAccess Forums > Microsoft® Access > Access Forms
I am trying the following on the on_open event of my mainform to disallow the user to edit the subforms.
but this is giving me a method or datamember not found.
What am I doing wrong?
instead of using an event, you could simply set the property setting "Locked", under the Data tab, of each subform to YES.
In the design mode of the subform is where you can set that value.
If you need to dynamically lock the subform, from its parent, use the subform control's "Locked" property
So, if the name of the subform control is "subComment", in the parent's VBA you would write:
Me.subComment.Locked = True
hope this helps
the reason i want to do it like that is because the code is in an if statement so depending on the results of the if statement the user can still edit the subform.
The Property is AllowEdits and since you want to refer to the SourceObject of the SubformControl, you need:
assuming that [subComment] is the name of the SubformControl.
Note: this may or may not work in the Open Event of the main Form.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.