I think I know the general rules, however for some reason it doesn't work for me.
I have a MainForm and a SubForm. On the Subform I have several controls some of which are "Program" related and some - "Course" related. As a rule if there are any entries in the "Program"related fields, there should not be any records in the "Course"related fields and visa-versa.
To solve this I am trying to do the following:
On the first "Program" related control useing the OnExit event I check if the value is Null and if not, then - lock/hide all the "Course" related controls. Here is the code I use:
'-- check if there is any entry for "ProgramId". If "Yes", then-------
'-- do not allow to enter any values that are only Course related ---------
If Not IsNull(Me.ProgramId) Then
Me.CourseId.Locked = True
Me.CourseId.Visible = False
Else: End If
-------END OF CODE----
None of these seems to work.
.visible = False does not hide the control. Is this because it is on a SubForm?
.Locked = True still lets me to go into the control and enter values.
Any ideas how to solve this problem would be appreciated.