Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Gray Out Fields < Product Catalog | Triple State >
Back to Gray Out Fields    Comments List
Grayed out fields Upload Images   Link   Email  
Giovanni Miranda      
15 months ago
Hello,
I was wondering about how I could gray out a field based on what another text box has a specific word typed in it?

Example:
I have a form that has one field called "AircraftProductorSkin" and another field called "SkinDescription". What I'd like to do is if the Field "AircraftProductorSkin" has the word "Skin" typed in the field the Field "SkinDescription" is available to add a description.  If any other word typed into the "AircraftProductorSkin" is not "Skin" then "SkinDescription" is grayed out and you canno enter text into it.

Now, I've got an OnCurrent event already setup for another Field called "Payware", if this is checked the the "Cost" Field is available for inputting.

Can I do that with the above description I have just explained with words instead of one of the Fields being a check mark Field?
Kevin Robertson            
15 months ago
Yes.

If AircraftProductorSkin = "Skin" then
    SkinDescription.BackColor = RGB(255, 255, 255)
    SkinDescription.Locked = False
Else
    SkinDescription.BackColor = RGB(200, 200, 200)
    SkinDescription.Locked = True
End If
Giovanni Miranda      
15 months ago
Interesting, I was considering the COLOR to help me with this but was unsure that it would work.  What I had going was somewhat similar to what you have suggested but my coding didn't use BackColor or Locked...let you know how it turns out.  Thank you for your input!
Giovanni Miranda      
15 months ago
I forgot to ask, where should this be coded under?

Privat Sub ????

End Sub

On Click
After Update
After Insert

Thanks
Kevin Robertson            
15 months ago
If you want the code to run after the field has been updated.
After Update

Also: On Current Event
Giovanni Miranda      
15 months ago
Even if I already have one On Current Event running?
Giovanni Miranda      
15 months ago

Kevin Robertson            
15 months ago
Have you created more then one ONCurrent event (copy & paste)? There can only be one in any single form module. Add your code to the existing OnCurrent event?
Giovanni Miranda      
15 months ago
Okay, the uploaded image is what I get when I try to write code that is already there but reversed from what I had before, let me explain...

This is the code that I originally wrote to test with:

Private Sub AircraftSkin_AfterUpdate()

  DisableProductFields
        
End Sub
Private Sub DisableProductFields()

  If AircraftSkin Then
        AircraftProduct.Enabled = False
        AircraftDescription.Enabled = False
    Else
        AircraftProduct.Enabled = True
        AircraftDescription.Enabled = True
    End If
    
End Sub
Private Sub Form_Current()
    DisableProductFields
End Sub

This code works fine, but when I do this in reverse...


Private Sub AircraftProduct_AfterUpdate()

    DisableSkinFields
    
End Sub
Private Sub DisableSkinFields()

If AircraftProduct Then
        AircraftSkin.Enabled = False
        SkinDescription.Enabled = False
    Else
        AircraftSkin.Enabled = True
        SkinDescription.Enabled = True
    End If

End Sub
Private Sub Form_Current()
    
    DisableSkinFields

End Sub


I get the an error, which I uploaded the image so you can see...it seems to me that I can't have 2 (Form_Current) events running on the same form.  If someone could help me I would really appreciate it.
Giovanni Miranda      
15 months ago
Yes I did, how can this be done on the same form? Or would I have to think of another way to do this?
Giovanni Miranda      
15 months ago
Or, somehow incorporate this in the current On_Current? If so, how???
Giovanni Miranda      
15 months ago
YEEEEEEEESSSSSSSSSSS! THANK YOU KEVIN!!!!!!!!!!!!! MY EYES HAVE BEEN OPENED!!!!!!!! I'm slow at times, but I do get there eventually!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Gray Out Fields.
 

 
 
 

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 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/14/2024 12:21:37 AM. PLT: 1s