Required field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aharding
    New Member
    • Sep 2006
    • 22

    Required field

    Hello..

    I know this has been asked before but i was hoping someone could help me with the codes to have one text or combo box be mandatory to get access to other fields in the form...all others maybe grayed out... until that one box is filled in.

    Any suggestions?
  • comteck
    New Member
    • Jun 2006
    • 179

    #2
    Try this. First, set the "Enabled" property to "No" for all textboxes, comboboxes, etc that you want greyed out. Then for the OnExit property for the textbox that you want the others to be dependant on, create an Event Procedure with the following code:

    If Me.textbox1 <>"" Then
    Me.textbox2.ena bled="Yes"
    Me.textbox3.ena bled="Yes"
    Me.combobox2.en abled="Yes"

    'and so on

    End If

    Hope this helps.
    comteck

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32636

      #3
      In the AfterUpdate subroutine for the controlling TextBox put in code which says
      Code:
      If {condition met} Then
          Object1.Enabled = True
          Object2.Enabled = True
      Else
          Object1.Enabled = False
          Object2.Enabled = False
      End If
      Otherwise, what I normally do (a bit more cryptic)
      Code:
      Object1.Enabled = {condition}
      Object2.Enabled = {condition}

      Comment

      • aharding
        New Member
        • Sep 2006
        • 22

        #4
        Originally posted by NeoPa
        In the AfterUpdate subroutine for the controlling TextBox put in code which says
        Code:
        If {condition met} Then
            Object1.Enabled = True
            Object2.Enabled = True
        Else
            Object1.Enabled = False
            Object2.Enabled = False
        End If
        Otherwise, what I normally do (a bit more cryptic)
        Code:
        Object1.Enabled = {condition}
        Object2.Enabled = {condition}

        Condition being

        If Me.POC <> "" Then (from post above???)

        The text box does not let me enter any data and all boxes are enable still...i think i need help with the condition....

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32636

          #5
          Is this what you're after?

          Code:
          Object1.Enabled = (Me.POC > "")
          Object2.Enabled = (Me.POC > "")

          Comment

          • aharding
            New Member
            • Sep 2006
            • 22

            #6
            Originally posted by NeoPa
            Is this what you're after?

            Code:
            Object1.Enabled = (Me.POC > "")
            Object2.Enabled = (Me.POC > "")

            Thanks...I think its working now!

            Comment

            • comteck
              New Member
              • Jun 2006
              • 179

              #7
              Sorry about that. I made a mistake. Do what NeoPa said.

              comteck

              Comment

              Working...