Solved

Grey out drop down menus when one is selected

Posted on 2004-10-08
8
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Webinar: Security & Encryption in the MySQL world

Join Percona’s Solutions Engineer, Dimitri Vanoverbeke as he presents “Security and Encryption in the MySQL world” on Thursday, July 6, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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…

688 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