About conditional formatting in a text box or other control on a form or report

About conditional formatting in a text box or other control on a form or report

If a control on a form or report contains values that you want to monitor, you can make it easier to spot different values in the control by applying conditional formatting. For example, you can make the control have a green background if sales exceed your forecast, or a red background if sales fall short. You can also make text bold, italic, or underlined, or enable or disable a control when it meets or doesn't meet criteria you specify.

By using conditional formatting, you can see how the values of controls compare to a constant or to the results of an expression. To specify the formatting criteria according to data in controls or according to multiple sets of criteria, you can use a logical expression. Learn about creating an expression.

You can set conditional formatting based on the value in a control, an arbitrary expression referencing another control, a user-defined Visual Basic for Applications function, or the control with focus. For example, you can set conditional formatting so that if an employee's salary exceeds $100,000 the field's background turns red. Or set formatting so that text in the City field is green and italic if a customer resides in Seattle.

If the value of the control changes and no longer meets the specified condition, Microsoft Access returns to the default formatting for the control. Conditional formatting remains applied to the controls until you remove the formatting, even though none of the conditions are met and the specified control formatting is not displayed.

Note   You can not use wildcards — such as the * (asterisk), ?, or any other symbol — in criteria as substitutions for characters in text or numbers.

Return to Conditional formatting in a text box or other control on a form or report