Change the color of a field on a form based on criteria

The attached has a form called "frmProperty"

The main form contains a field called "units" that represent the total units in the building. So for the first property, that field says the building has 40 units.  

The subform "subfrmVacyUnits" totals the number of "units by type" in the form footer.  That field is called "SumUnitNo."  In the first property, the units by type total 33.

Based on the above, we are missing 7 more units.

I would like the field in the subform "SumUnitNo"   to turn bright yellow (or whatever color) if the "SumUnitNo"  does not equal the field "units" in the building.

Is there a way to easily do this?

Thanks!
ChangeFieldColor.mdb
Patty01AccessAsked:
Who is Participating?
 
mbizupCommented:
Use conditional formatting:

- Right click the textbox in your subform and select Conditional Formatting...
- Set the conditional formatting for the field value

<> Forms!FrmProperty!Units

- Select Yellow for the background color for that condition
ChangeFieldColor.mdb
0
 
Patty01AccessAuthor Commented:
Great!  Never knew that existed, and how powerful it can be.

Thanks much mbizup!
0
 
mbizupCommented:
Its a great feature!

In Access 2003 (since you're using a .mdb file), you can apply up to three different conditions/formats per control.

In Access 2010, you can use up to 50 different conditions per control, which is way more than you'll ever reasonably need :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.