Solved

Grey out drop down menus when one is selected

Posted on 2004-10-08
8
269 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:irishmanjb
  • 4
  • 4
8 Comments
 
LVL 14

Expert Comment

by:JohnK813
ID: 12261225
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"
0
 

Author Comment

by:irishmanjb
ID: 12261326
How do I apply this?

Thanks
0
 

Author Comment

by:irishmanjb
ID: 12261403
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
0
 
LVL 14

Expert Comment

by:JohnK813
ID: 12262003
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
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 14

Accepted Solution

by:
JohnK813 earned 500 total points
ID: 12262950
I was hoping to explain/teach further, but I'm about to leave on a 3 day weekend, and I don't want to leave you hanging.  While you're in design view of your form, go to View menu -> Code.  Copy and paste the following into the code window:

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

Private Sub combo2_AfterUpdate()
  combo1.Enabled = False
  combo3.Enabled = False
End Sub

Private Sub combo3_AfterUpdate()
  combo1.Enabled = False
  combo2.Enabled = False
End Sub

Private Sub ResetButton_OnClick()
  combo1.Enabled = True
  combo2.Enabled = True
  combo3.Enabled = True
Exit Sub



Of course, you'll have to create a button called ResetButton
0
 

Author Comment

by:irishmanjb
ID: 12276220
Thanks  very much we are trying the updates now.

John
0
 

Author Comment

by:irishmanjb
ID: 12308187
Thanks it worked!

0
 
LVL 14

Expert Comment

by:JohnK813
ID: 12308413
Not a problem.  Glad I could help!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I guess that all of us know that caching the data usually increase the performance, but I worried if all of us are aware about the risk that caching the data provides and how to minimize this.  That’s the reason why I decided to write this short art…
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now