Enabling/ Disabling Combo Boxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cillies

    #1

    Enabling/ Disabling Combo Boxes

    Hi All,

    This message is a continuation of an earlier post, so please accept my
    apologies as I believe I would get a better response this way.

    Problem:

    I have 4 combo boxes which I want to able to enable/ disable depending
    on the selection made in the first combo.

    Below I have the code I am using

    Private Sub Lead_AfterUpDat e()

    Me.Purchase.Ena bled = Not (Me.Lead = "Not Interested")
    Me.Package.Enab led = Not (Me.Lead = "Not Interested")
    Me.Users.Enable d = Not (Me.Lead = "Not Interested")
    End Sub

    This works fine, But I now need to add another option in the 'Lead'
    combo box to do the same thing.

    i.e.
    the user can select "Not Interested" and 'Purchase', 'Package',
    'Users' become disabled.

    Now I need the user to select "Unavailabl e" and return the same
    results. eg disable 'Purchase', 'Package', 'Users'.

    kindest regards
  • tom

    #2
    Re: Enabling/ Disabling Combo Boxes

    Try This (warning: Air Code. Untested.:

    Private Sub Lead_AfterUpDat e()

    On Error Resume Next

    Dim EnableEm as Boolean
    Dim LeadVal as String

    LeadVal = nz(Me.Lead.Valu e, "")

    EnableEm = Not ((LeadVal = "Not Interested") Or (LeadVal =
    "Unavailabl e") Or (Leadval = ""))

    Me.Purchase.Ena bled = EnableEm
    Me.Package.Enab led = EnableEm
    Me.Users.Enable d = EnableEm


    End Sub


    lee@prologic.ie (Cillies) wrote in message news:<ba262325. 0405240652.5fea f745@posting.go ogle.com>...[color=blue]
    > Hi All,
    >
    > This message is a continuation of an earlier post, so please accept my
    > apologies as I believe I would get a better response this way.
    >
    > Problem:
    >
    > I have 4 combo boxes which I want to able to enable/ disable depending
    > on the selection made in the first combo.
    >
    > Below I have the code I am using
    >
    > Private Sub Lead_AfterUpDat e()
    >
    > Me.Purchase.Ena bled = Not (Me.Lead = "Not Interested")
    > Me.Package.Enab led = Not (Me.Lead = "Not Interested")
    > Me.Users.Enable d = Not (Me.Lead = "Not Interested")
    > End Sub
    >
    > This works fine, But I now need to add another option in the 'Lead'
    > combo box to do the same thing.
    >
    > i.e.
    > the user can select "Not Interested" and 'Purchase', 'Package',
    > 'Users' become disabled.
    >
    > Now I need the user to select "Unavailabl e" and return the same
    > results. eg disable 'Purchase', 'Package', 'Users'.
    >
    > kindest regards[/color]

    Comment

    • Reggie

      #3
      Re: Enabling/ Disabling Combo Boxes

      Have you tried a select case statement
      (Air Code)

      Private Sub Lead_AfterUpDat e()
      Dim strLead as String
      strLead = Me.Lead
      Select Case strLead
      Case "Not Interested"
      Me.Purchase.Ena bled = True
      Me.Package.Enab led = True
      Me.Users.Enable d = True

      Case "Unavailabl e"
      Me.Purchase.Ena bled = False
      Me.Package.Enab led = False
      Me.Users.Enable d = False
      Case Else

      Comment

      • Reggie

        #4
        Re: Enabling/ Disabling Combo Boxes

        Have you tried a select case statement
        (Air Code)

        Private Sub Lead_AfterUpDat e()
        Dim strLead as String
        strLead = Me.Lead
        Select Case strLead
        Case "Not Interested"
        Me.Purchase.Ena bled = True
        Me.Package.Enab led = True
        Me.Users.Enable d = True

        Case "Unavailabl e"
        Me.Purchase.Ena bled = False
        Me.Package.Enab led = False
        Me.Users.Enable d = False
        Case Else

        Comment

        • devdex.com

          #5
          Re: Enabling/ Disabling Combo Boxes

          Thanks guys, It works a treat.

          Tom, Your air code was spot on. Reggie I encountered some problems with
          your select case statement, where it would disable the combos but not in
          the way intended. after selecting options in the combo1 box twice, all
          the combos would become enabled, but thanks very much for your time and
          consideration with my problem, much appreciated.


          kindest Regards




          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          • devdex.com

            #6
            Re: Enabling/ Disabling Combo Boxes

            Thanks guys, It works a treat.

            Tom, Your air code was spot on. Reggie I encountered some problems with
            your select case statement, where it would disable the combos but not in
            the way intended. after selecting options in the combo1 box twice, all
            the combos would become enabled, but thanks very much for your time and
            consideration with my problem, much appreciated.


            kindest Regards




            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            Working...