Solved

Grey out drop down menus when one is selected

Posted on 2004-10-08
8
295 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
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.

 
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

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

831 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