?
Solved

Grey out drop down menus when one is selected

Posted on 2004-10-08
8
Medium Priority
?
310 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
Technology Partners: 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 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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