Enable/Disable button based on combo box

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?
 
R

Rick Brandt

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
 

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