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 
Grey Out Fields
Jared Livingston 
      
10 months ago
I followed the "How to Gray Out Fields Based on A Selected Value in Microsoft Access Forms" video and came across an issue. How do I accomplish the same result but use results from a drop down box instead of an Is Active field?

The VBA is:

Private Sub IsActive_AfterUpdate()

If IsActive Then

FamilySize.Enabled = IsActive
CustomerSince.Enabled = IsActive
CreditLimit.enabled = IsActive

How should the VBA look if I'm using a drop down menu labeled "RequestType" and I want to grey out the three above listed fields if the drop down menu is blank (nothing selected)?

Thanks for your help!
Sami Shamma  @Reply  
             
10 months ago
Hi, Jared.

First, I recommend you use Richard's naming convention. So if "RequestType" Is a combo box; it should be named "RequestTypeCombo".

The if statement you need will look like this:

If IsNull(RequestTypeCombo) then
Raymond Spornhauer  @Reply  
          
10 months ago
Jared

I would write the VBA Code of IsActive as follows:

Private Sub IsActive_AfterUpdate()

If IsActive Then
     FamilySize.Enabled = True
     CustomerSince.Enabled = True
     CreditLimit.enabled = True
Else
     FamilySize.Enabled = False
     CustomerSince.Enabled = False
     CreditLimit.enabled = False
End If

You will also need to add this code to the Form OnCurrent Event.
Raymond Spornhauer  @Reply  
          
10 months ago
Jared

For a ComboBox, you can use what Sami put above... and/or you can also make fields inactive based on options in your combox.  (assuming you set those up the way Rick suggests):

If RequestTypeCombo = X OR RequestTypeCombo = Y  OR RequestTypeCombo = Z Then
     FamilySize.Enabled = True
     CustomerSince.Enabled = True
     CreditLimit.enabled = True
Else
     FamilySize.Enabled = False
     CustomerSince.Enabled = False
     CreditLimit.enabled = False
End If

Again.. add this to your Form OnCurrent Event.
Raymond Spornhauer  @Reply  
          
10 months ago
Jared

Another more advanced option you could incorporate:

In the Table for your ComboBox options... add a Field called 'EnableFields' and make this a boolean field.  Now you will be able to set which combo box selections will be used to enable fields.  You will need to either manually update this field in the Table for what your want, or add this Field to the Form you use for your ComboBox options.

When you add the ComboBox to your form, add this field to the Row Source, then set the Column Width for this field to 0" (so it's not shown).

Now your VBA Code can look like this:

If RequestTypeCombo.Column(X) Then
     FamilySize.Enabled = True
     CustomerSince.Enabled = True
     CreditLimit.enabled = True
Else
     FamilySize.Enabled = False
     CustomerSince.Enabled = False
     CreditLimit.enabled = False
End If

' RequestTypeCombo.Column(0): this is the first option in the combo box
' RequestTypeCombo.Column(1): this is the second option in the combo box
' RequestTypeCombo.Column(2): this is the third option in the combo box
' etc....

Again... add this to your Form OnCurrent Event.
Jared Livingston OP  @Reply  
      
10 months ago
Thank you Sami and Raymond! Your recommendations have been very helpful.

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 12:53:56 PM. PLT: 0s