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 Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Use Conditional Format
Mark Pierce 
     
3 years ago
Is it possible to use conditional formatting to change text color in that specific record only based on specific conditions from a form field?

What I need to do is:
Example:
For 4" pipe (Field [PipeOD] has 4" in it) the ID measurement is condition is +0.22 in is pass, -0.025 is fail. So, the conditional formatting turns the field text Red if out on range.

If a new form record is created and has 5" pipe (Field [PipeOD] has 5" in it) the ID measurement is condition is +0.55 in is pass, -0.050 is fail. So, the conditional formatting turns the field text Red if out on range.

Is it possible to set different conditions to a field based on what a specific file has in it?

I have the conditional format course, but I don't see how to do what I need to do.

Kevin Yip  @Reply  
     
3 years ago
You can add a formatting rule that uses an "expression" as shown in the picture below.  Type in an expression that will evaluate to either true or false.  When it is true, the specified formatting will be used.  For instance, an expression to test whether [PipeOD] contains 4" would be:

     InStr(1, [PipeOD], "4""") <> 0
Kevin Yip  @Reply  
     
3 years ago

Mark Pierce OP  @Reply  
     
3 years ago
Okay then after I set the expression to True for 4" pipe, I still need to set the condition of if it is between x and y then format red. How do you set a second condition based on a true prior condition result?
Kevin Yip  @Reply  
     
3 years ago
You add a second condition with the AND operator.  E.g.:

    InStr(1, [PipeOD], "4""") <> 0 AND (Something >= x AND Something <= y)

If both of these conditions are true, i.e if PipeOD contains 4" and something is between x and y inclusively, then the specified formatting will be used.
Mark Pierce OP  @Reply  
     
3 years ago
This is what it would look like but I am getting a invalid syntax error.

=InStr(1,[Size_Write],"3-1/2""")<> 0 AND ([BoxThreadOvality],>=-0.003 AND <=+0.004)
Kevin Yip  @Reply  
     
3 years ago
The second condition should be:

     ([BoxThreadOvality] >= -0.003 AND [BoxThreadOvality] <= 0.004)

The correct syntax for such a condition is:

   Something >= x AND Something <= y

It is not:

   Something >= x AND <= y
Mark Pierce OP  @Reply  
     
3 years ago
Thanks very much Kevin, this is an area I struggle!
Kevin Yip  @Reply  
     
3 years ago
You're welcome.  Expressions are part of VBA.  That may be why Richard didn't include this in his video for conditional formatting.
Richard Rost  @Reply  
          
3 years ago
Fast Tip: Expression Is
Course: Access Expert 19

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 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 9:41:15 AM. PLT: 0s