Conditional formatting in Access - how it works
With conditional formatting, you can highlight certain fields or values in Access. We explain to you how you can use this feature in Access forms.
Call conditional formatting in Access
With the procedure described here, you can start conditional formatting in Access from version 2010.
- Open the relevant form in the design view. To do this, click on "View"> "Design View" in the "Start" ribbon.
- Select the field whose values you want to highlight.
- Navigate to the Format tab.
- Click the Conditional Formatting button in the Control Formatting group, and then click the New Rule button.
- In the dialog that opens, select the rule type "Check values in the current data record or use an expression".
- Another rule type is "Compare with other data records". This allows you to highlight the values of a field in comparison to other data records by the width of the bars.
- This type of display is particularly suitable for use in continuous forms, since the data records are displayed one below the other.
Set conditions for conditional formatting in Access
Now select one of the possible conditions.
- With "Field value is" you define formatting if the value of the field meets a certain condition.
- "Expression is" specifies formatting that can depend not only on the value of the current field, but also on other fields or on completely different factors. If you click on the button with the three dots, you will be taken to the "Expression Generator". The possible expression categories and expression values are suggested there. Here you will also find examples of the structure of the formulas.
- With the selection "Field has focus" you define a formatting which is displayed when the cursor is in the named field.
Application example of conditional formatting in Access
If you want to highlight an article whose stock is less than 10 pieces, use conditional formatting for the "Piece" field.
- Select the corresponding field in the design view of the form and open the dialog for editing the conditional formatting.
- First select "Field value is" and then "Between". Then enter from 1 to 9.
- The next step is to choose a suitable color for the font and / or the background.
- Click the OK button".
- Switch back to the form view.
- All data records in which the number of pieces is less than 10 are now shown in the format you have selected.