Hello Forum,
I am trying to open a form and lock all controls in said form. There are also two subforms in this form and I would like their controls to be locked too.
I'm trying to work around the following code but my skills in VBA being what they are, I am stuck...
Code:
Private Sub CmdOpenPersonal_Click()
Dim ctrl As Control
DoCmd.Close 'closes the main "welcome" form where CmdOpenPersonal button is
DoCmd.OpenForm "FmPersonalInfo"
For Each ctrl In Forms("FmPersonalInfo").Controls
ctrl.Locked = True
Next ctrl
End Sub
Each time I click on CmdOpenGeneral, I get the "Error 438 - object doesn't support this property or method" and VBA points to ctrl.Locked = True
Is it because two of the controls in my form are subforms?
Your help would be much appreciated... And thank you in advance.