3 Comboboxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Beany
    New Member
    • Nov 2006
    • 173

    3 Comboboxes

    Hi,

    How can i hide or disable one combobox when another combobox is selected?

    All help will be appreciated

    thanks
  • damonreid
    Recognized Expert New Member
    • Jul 2007
    • 114

    #2
    You can just do an if loop or a case select on each of the combo boxes to disable the other ones when selected on the first.
    [code=vb]me.comboboxnumb er.enabled = false[/code]

    Comment

    • Beany
      New Member
      • Nov 2006
      • 173

      #3
      Originally posted by damonreid
      You can just do an if loop or a case select on each of the combo boxes to disable the other ones when selected on the first.
      [code=vb]me.comboboxnumb er.enabled = false[/code]

      ok thats brill..but how would i enable them by clicking on them?

      Comment

      • damonreid
        Recognized Expert New Member
        • Jul 2007
        • 114

        #4
        If you want to be able to change it perhaps you should change the locked status and not the enable status? If this is what you want to do then.

        Else try this.
        [code=vb]me.comboboxname .enable = true[/code]

        Comment

        • Beany
          New Member
          • Nov 2006
          • 173

          #5
          Originally posted by damonreid
          If you want to be able to change it perhaps you should change the locked status and not the enable status? If this is what you want to do then.

          Else try this.
          [code=vb]me.comboboxname .enable = true[/code]

          sorry but i dont understand, ive got three comboboxes, Combo2, Combo4 and Combo6.

          Ive put the following in Combo2:

          Code:
          Private Sub Combo2_AfterUpdate()
              blnUser = True
              FilterSubForm
              
              Me!Text18.ControlSource = "[ID]"
            
            Me.Combo4.Enabled = True
            Me.Combo6.Enabled = True
              Me.Combo2.Requery
          End Sub
          But its not doing anything? am i doing something obviously wrong?

          Comment

          • damonreid
            Recognized Expert New Member
            • Jul 2007
            • 114

            #6
            Do you want them to only use one combo box?
            If so change the ".enabled = true" to ".enabled = false" for the other two combo boxes.

            Comment

            • Beany
              New Member
              • Nov 2006
              • 173

              #7
              Originally posted by damonreid
              Do you want them to only use one combo box?
              If so change the ".enabled = true" to ".enabled = false" for the other two combo boxes.

              okay but then i cant click on the other two... it disables them...


              What i want is: The user can only select from one combobox but if he wants to select from another, he just puts the cursor over it and it enables...

              i was told this wasnt possible? is that true?

              Comment

              • damonreid
                Recognized Expert New Member
                • Jul 2007
                • 114

                #8
                I am not sure what the point is in disabling them, why not just leave the fields open?

                You could add an "After Update" event on each of the fields to clear the values in the other two if you want?

                Comment

                • Beany
                  New Member
                  • Nov 2006
                  • 173

                  #9
                  Originally posted by damonreid
                  I am not sure what the point is in disabling them, why not just leave the fields open?

                  You could add an "After Update" event on each of the fields to clear the values in the other two if you want?

                  Ok, thats a good idea, becoz the comboboxes dont clear...

                  what would i put in the after update event for it to clear?

                  thanks so far bud

                  Comment

                  • damonreid
                    Recognized Expert New Member
                    • Jul 2007
                    • 114

                    #10
                    Try this
                    [code=vb]me.comboxboxnam e.value = ""[/code]

                    Comment

                    • Beany
                      New Member
                      • Nov 2006
                      • 173

                      #11
                      Originally posted by damonreid
                      Try this
                      [code=vb]me.comboxboxnam e.value = ""[/code]

                      thanks damon! for all the help

                      Comment

                      • damonreid
                        Recognized Expert New Member
                        • Jul 2007
                        • 114

                        #12
                        No problem, glad I could help.

                        Comment

                        Working...