Link to home
Start Free TrialLog in
Avatar of irishmanjb
irishmanjb

asked on

Grey out drop down menus when one is selected

I have a form in Access that has three drop down boxes with variaous information.
When the user selects any one of the drop down menus and drills down to the selection they want I want to grey out the other 2 drop down menus.

How can I do this?

Thanks
Avatar of JohnK813
JohnK813
Flag of United States of America image

The AfterUpdate event fires after something is selected in a combo box.  The Enabled property determines if somethine is grayed out or not.

Assuming your combo boxes are named combo1, combo2, and combo 3, start with this:

Private Sub combo1_AfterUpdate()
  combo2.Enabled = False
  combo3.Enabled = False
End Sub

This will gray out combo2 and combo3 as soon as something is selected in combo1.  You'll of course have to add Subs for combo2 and combo3 as well.  To "un-gray out" a combo box, use "combo2.Enabled = True"
Avatar of irishmanjb
irishmanjb

ASKER

How do I apply this?

Thanks
I am assuming that I put in the afterupdate field.

One question if someone wanted to go back and change the selection after it was greyed out how can they do that?

Thanks
You can add that to your Visual Basic code.  If you haven't used VB before, I can walk you through it.

What to do if a user wants to change a selection is up to you.  My first thought would be to include a "reset" or "clear" button that clears the selection and un-grays the three combo boxes.

(also in VB)

Private Sub ResetButton_OnClick()
  combo1.Enabled = True
  combo2.Enabled = True
  combo3.Enabled = True
Exit Sub
ASKER CERTIFIED SOLUTION
Avatar of JohnK813
JohnK813
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks  very much we are trying the updates now.

John
Thanks it worked!

Not a problem.  Glad I could help!