Enable/Disable button based on combo box

  • Thread starter Thread starter David
  • Start date Start date
D

David

I have a combo box with a button underneath. The button is
disabled when the form is first shown and enabled when a
combo box selection is made. However, when I return to the
form after the button is pressed, I get an error because
focus is on the button and I am trying to disable it. How
do I test where focus is so I can bypass the disable? Or,
alternatively, how do I test for a selection in the combo
box so I can base it on that?
 
David said:
I have a combo box with a button underneath. The button is
disabled when the form is first shown and enabled when a
combo box selection is made. However, when I return to the
form after the button is pressed, I get an error because
focus is on the button and I am trying to disable it. How
do I test where focus is so I can bypass the disable? Or,
alternatively, how do I test for a selection in the combo
box so I can base it on that?

In all places in your code where you disable the button just add a
preceding line that moves focus to a different control.

Me!ComboBoxName.SetFocus
Me!ButtonName.Enabled = False
 
Back
Top