Reputation: 643
Is there way to use conditional formatting (similar to excel) to a text box in an ms access form? The user will enter a number in the text box. If the number is between 0-25 is red, if its from 26-50 its yellow, if its from 51-75 than green and 76-100 blue.
How can this be done in MS Access? ?
Upvotes: 0
Views: 2342
Reputation: 97131
Note as @Nexus mentioned below, the FormatConditions
collection will only accept 3 conditions. But you were aiming for 4 conditions. Unless you can consolidate those into only 3, you won't be able to use Access' conditional formatting feature for this.
With the form in Design View, right-click the text box and choose "Conditional Formatting ..." from the context menu.
Select "Field Value Is" from the drop-down under Condition 1, "between" in the second drop-down, and enter your start (0) and end (25) range values in the next 2 boxes. Choose red from the Font/Fore Color drop-down.
Click the "Add >>" button to add another condition (Condition 2). Set the values for that condition: 26; 50; and yellow.
Repeat for the remaining conditions.
Here's a screen capture of your first 2 conditions applied to a text box. (I chose light grey for the background color so the foreground colors would be more distinct in format preview area.)
Upvotes: 2