Results 1 to 4 of 4

Thread: Disable fields

  1. #1
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Unanswered: Disable fields

    Hi,

    I have a db which has a drop-down list with 3 options. When a user has chosen for option 1 I want to make it possible to fill in fields 1 and two.
    When a user choses for the other options I want the user to see that the fields are grey and that they can't fill anything in.

    I have no idea how to do this though. I would be so greatful if anyone could give me a hint as to what to do.

    Thanks,
    Charlotte

  2. #2
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    You need to put some code in the after update event of the combo box which contains the values you want to evalutate. For instance say the combo box name is 'cboMyCombo' and its values are 1, 2, 3. You would put code similar to the following in the after update event of the combo:

    Select Case Me.cboMyCombo.Value
    Case is = 1
    ME.ComboNameToBeDisabled.Enabled = True
    Me.SecondComboNameToBEDisabled = True
    Case Else
    ME.ComboNameToBeDisabled.Enabled = False
    Me.SecondComboNameToBEDisabled = Fasle
    End Select


    Hope that helps.

  3. #3
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    One more question...

    PERFECT. THankyou so much. Just one more question: Is it possible to clear all options if, say, if a specific option was chosen? (I hope I am being clear here)
    Last edited by charlottevk; 06-03-04 at 09:31.

  4. #4
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    Sure, the syntax would be similar:


    Select Case Me.cboComboToEval.Value
    Case is = 1
    '''enable fields as before
    Case is = 2
    me.combo1.value = ""
    me.combo2.value = ""
    Case is = 3
    ''disable the fields maybe, or anything else you want it to do
    Case else
    msgbox "Invalid entry"
    End select

Posting Permissions

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