none
Access Form Field Fore Color Changes but no apparent event triggered

    Question

  • I inherited an Access database with a main form consisting primarily of many count fields (Text) that are updated by VBA logic but not associated with a table data element

    When the count in any cell is updated to 6 or greater the fore color changes to red.

    The form does not have any associated events that would cause this and I can't find any code that references  "Forecolor" for any fields

    Where could the logic be buried that would be tripped as soon as the value is set to 6 or greater?

    Tuesday, October 31, 2017 4:01 PM

Answers

  • It is most probably done by using conditional formatting.

    Open the form in design view.

    Select one of the relevant text boxes.

    Activate the Format tab of the ribbon (under Form Design Tools).

    In the Control Formatting Group, click Conditional Formatting.

    You will see one of more "rules".

    Select a rule, then click Edit Rule to view and edit its definition.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by BVitter Tuesday, October 31, 2017 11:19 PM
    Tuesday, October 31, 2017 4:52 PM

All replies

  • It is most probably done by using conditional formatting.

    Open the form in design view.

    Select one of the relevant text boxes.

    Activate the Format tab of the ribbon (under Form Design Tools).

    In the Control Formatting Group, click Conditional Formatting.

    You will see one of more "rules".

    Select a rule, then click Edit Rule to view and edit its definition.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by BVitter Tuesday, October 31, 2017 11:19 PM
    Tuesday, October 31, 2017 4:52 PM
  • Thank you, I have never looked at format rules in Access before
    Tuesday, October 31, 2017 11:20 PM
  • Works great for the equal condition but it does not work for greater than

    Single rule: Field value is greater than or equal to 9, font color red

    If field value is 8 or 10, the font is black

    Saturday, November 04, 2017 11:30 PM
  • Does it make a difference if you set the Format property of the text boxes to General Number?

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Sunday, November 05, 2017 8:36 AM
  • Changing the field format to a number did not change the result but that did trigger a fix

    The maximum value I am testing for is 9 - Greater than or equal to 9 works for 9 but not 10

    I added a second rule greater than or equal to 10 and that works so apparently the form field (it is not associated with a table cell) is text even if the format is set to number

    Sunday, November 05, 2017 6:58 PM
  • You could change the rule as follows:

    Select 'Expression Is' from the first combo box.
    Enter the following expression in the box next to it:

    Val([NameOfTextBox])>=9

    where NameOfTextBox is the name of the text box.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Sunday, November 05, 2017 8:48 PM
  • Thanks, that worked
    Wednesday, November 08, 2017 6:50 PM