Solved

Grey out drop down menus when one is selected

Posted on 2004-10-08
8
279 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What should be a storage size for SQL in day1, day2 and day 3 7 79
How to SQL Trace a SPECIFIC query 24 57
append to an ms access field 6 21
SSRS troubles 4 12
APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

911 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