Help with ComboBox in VBA

A

Ayo

I have form with 2 ComboBoxes (Market and Phase), 1 Frame with 3
OptionButtons (Today, Tomorrow, Both). I am trying to set up a process where
all the controls on the form are disabled except for Market.
When a value is selected for Market, Phase becomes enabled.
When a value is selected for Phase, the frame and all the OptionButtons
becomes enabled.

Now if I go into the Phase ComboBox and manually delete the value in it, I
want the frame and all the OptionButtons to become disabled. How do I do
this? So far all I have is this:

Private Sub cmbPhase_Change()
If Not IsNull(Me.cmbPhase.Text) Then
Me.frmReport.Enabled = True
Me.optBoth.Enabled = True
Me.optToday.Enabled = True
Me.optTomorrow.Enabled = True
ElseIf IsNull(Me.cmbMarket.Text) Then
Me.frmReport.Enabled = False
Me.optBoth.Enabled = False
Me.optToday.Enabled = False
Me.optTomorrow.Enabled = False
End If
End Sub

Any help will be greatly appreciated.
Thanks
Ayo
 
J

JLGWhiz

Would hiding and unhiding the controls work just as well?

In the form initialize event, hide the phase combobox and the frame. When
the Market combobox is clicked, use the click event code to unhide the phase
combobox. When the phase combox is clicked, use the click event code to
unhide the frame.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top