Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Posts
    65

    Question Unanswered: How to disable/hide/lock controls

    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:

    ------CODE BEGINS--------
    '-- 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
    'or
    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.
    Thanks,
    Jazz

  2. #2
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    This is just a suggestion , try this

    If Not IsNull(Me.ProgramId) Then
    Me.CourseId.Locked = True
    Else
    Me.CourseId.Visible = False
    End If

  3. #3
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    OR


    If Not IsNull(Me.ProgramId) Then
    Me.CourseId.Locked = True
    Me.CourseId.Visible = False
    Else
    Me.CourseId.Locked = False
    Me.CourseId.Visible = True
    End If

    There might be others out there that might have a better solution.
    Last edited by billjov; 05-19-03 at 01:31.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •