Consulting

Results 1 to 5 of 5

Thread: List Box and combobox control help needed

  1. #1

    List Box and combobox control help needed

    Hello,
    I have a list box on a form with 3 combo boxes. Depending on the users selection of the list box, 2 of the 3 combo boxes are enabled for the user to make selections on.

    If the user proceeds to a combo box that is enabled, makes a selection and then chooses to go back up to the list box, the combo box does not reset.

    Can someone help me out. Essentially, I need to know how to reset the combo boxes should the user make a different selection in the list box.

    Thank you in advance!!

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Me.comboboxname.requery

    Where comboboxname is the actual name of your combo box.

  3. #3
    Thank you, I'm a newbie so I need a bit more understanding. Where in this code would I put this:
    Enum SalesPeriodEnum    ByQuarter = 1
        ByTerm = 2
        ByYear = 3
    End Enum
    Private Sub lstSalesPeriod_AfterUpdate()
        SetSalesPeriod Me.lstSalesPeriod
    End Sub
    
    
    Sub SetSalesPeriod(SalesPeriod As SalesPeriodEnum)
        Me.lstSalesPeriod = SalesPeriod
        Me.cbTerm.Enabled = (SalesPeriod = ByTerm)
        Me.cbQuarter.Enabled = (SalesPeriod = ByQuarter)
    End Sub

  4. #4
    OMG - I figured it out!! Thank you for the direction!!!

    Private Sub lstSalesPeriod_AfterUpdate()    SetSalesPeriod Me.lstSalesPeriod
        cbYear = Null
        cbQuarter = Null
        cbTerm = Null
        cbYear.Requery
        cbQuarter.Requery
        cbTerm.Requery
    End Sub

  5. #5
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Well done, sorry for the delay in getting back to you.

Tags for this Thread

Posting Permissions

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