PDA

View Full Version : [SOLVED:] List Box and combobox control help needed



sdmikejr
03-24-2018, 10:23 PM
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!!

OBP
03-25-2018, 03:16 AM
Me.comboboxname.requery

Where comboboxname is the actual name of your combo box.

sdmikejr
03-25-2018, 07:09 AM
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

sdmikejr
03-25-2018, 07:39 AM
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

OBP
03-25-2018, 09:44 AM
Well done, sorry for the delay in getting back to you.