Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Combo boxes
Masih Ostad 
     
4 years ago
Hi.
I have check boxes for staff in my form. If the check box is false I want that name in the combo box to be disabled or greyed out. Is that possible with if statement?

Thanks
Kevin Robertson  @Reply  
          
4 years ago
Yes. Check out If Then and On Current Event

If myCheckBox Then
   myCombo.Enabled = True
Else
   myCombo.Enabled = False
End If
Scott Axton  @Reply  
        
4 years ago
Kevin I think we need clarification from Masih as to what he is trying to accomplish.
The way I read this question is, perhaps, different than you.

The way I read this was that he was asking if there was a way to limit the choices within the combo box itself.
Not turn the combo box as a whole on and off.

If that is the case, my answer is NO.  You can't gray out a choice in the combo box.  
By using a query as the data source for the combo box, you could limit whether or not the staff name appears in the combo box.
Kevin Robertson  @Reply  
          
4 years ago
Scott You are absolutely right. I read the question wrong.
Kevin Yip  @Reply  
     
4 years ago
Hi Masih, you need to a create a "fake combo box".  Richard has actually made a video on this topic.  Search his YouTube channel for "Can you have a List Box or Combo Box with Formatting and Colors?"  Basically, the fake combo box is a continuous form.  You set a conditional format that would disable a control when certain conditions are met.  I did an example below.  If I uncheck "show Asian countries", all Asian countries in the combo box will be disabled.  Unfortunately, disabled controls always have a grey background color.  That's a Windows system setting that cannot be easily changed.  So you would need to have a grey background for your entire combo box to make it look right.  Also, you would need much VBA coding.  Since it's a fake combo box, you have to fake its opening and closing, and you even have to create a fake dropdown button and program its behavior with VBA.
Kevin Yip  @Reply  
     
4 years ago

Masih Ostad OP  @Reply  
     
4 years ago
Thanks!  How can I make a fake combo box? Do you have a video on that?
Kevin Yip  @Reply  
     
4 years ago
Search YouTube for "Computer Learning Zone Combo Box with Formatting" to see Richard's video on fake combo boxes and list boxes.  He doesn't mention disabling a field specifically, but you can apply his method to achieve it.  Whatever formats you can use on a subform, you can do it on a fake combo box or list box.
Scott Axton  @Reply  
        
4 years ago
Masih Ostad OP  @Reply  
     
4 years ago
Thanks! I watched that video but it' all about a list box. How can I make a combo box out of a continous form?
Masih
Kevin Yip  @Reply  
     
4 years ago
The basic methodology in the video is the same for a combo box: you open and close it with VBA depending on user action.  The only difference is that a combo box has that little dropdown button, for which you can add a Click event.  But you'll have to write basically the same VBA code: for opening and closing the fake combo box accordingly.  Both Richard and I use a continuous form for faking a combo/list box.  So watching Richard's video should give you all the knowledge you need.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 7:48:30 PM. PLT: 1s