How can I set conditional formatting on form to display different color of text dependng on value.

Anonymous
2018-05-12T23:27:40+00:00

Hi,

I am trying to set the font color  of some of fields on a subform to change depending on the value. I had seen a post somewhere that I need to use conditional format  on the fields I want to change. I've tried to do this on the first field which is Systolic

My target values are stored in a table named My Profile with the fields named in the format of TargetLoSystolic

My conditions are as shown in the screenshot:

I clicked enable on the first 2 rules which is why they appear to be greyed out but the first rule should be display Yellow text for the value, the second displays red for High value and I've changed third rule to display green for in range.

I've also tried expressiona similar to [Systolic] < [My Profile]![TargetLoSystolic]

From what I see, my font color does not change regardless of how I try and change the expression. I've also tried to enable the rule and also not click the enable button. I see no difference.

What am I doing wrong?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

9 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,091 Reputation points MVP Volunteer Moderator
    2018-05-13T04:16:53+00:00

    Check this out: https://1drv.ms/u/s!AnmKsZFxs8\_Kh6gQsQ4GMfNDtnvQ4w

    It works just fine.

    0 comments No comments
  2. Anonymous
    2018-05-13T15:04:13+00:00

    Tom,

    Thanks for your replies, I will address your replies in order.

    1. The control on my form is named txtSystolic as it is a text box on the form but the Control source from the table is numeric and set to integer.
    2. As to the minor problem setting the default to 0 and not null I'll give my explanation. I have usually  kept default settings in my controls on reports and forms and as far as my field definitions in the tables the same, I'll select the type of data for that field and leave the the options to default unless I know I need something specific.

    I am aware that what I am doing with regards to keeping defaults may be bad practice.

    Thanks I checked out  the database you sent the link for and even successfully modified it to color code the Diastolic and even added Glucose levels and got them all to color code. I am trying to incorporate into my database to color code both the datasheet subform and the main form to enter the blood pressure values and glucose. My incorporation does not display colors.

    The link to my database is https://1drv.ms/u/s!Av2G9Nc5BDMxfSE9BupeOcLEfUE

    Again, if possible I'd like to color code the Blood pressure and glucose levels on both the Datasheet Subform and the actual entry form for those values. If it is not possible on the subform its not a big deal. I am assuming something is wrong with my syntax even those I copied from your database and made changes to mine.

    Thanks again

    0 comments No comments
  3. Tom van Stiphout 40,091 Reputation points MVP Volunteer Moderator
    2018-05-13T17:31:19+00:00

    Remember what I said about notational difficulties? It bit you. Go back and look very carefully at the DLookup statements. Then don't change them, but change your table name.

    0 comments No comments
  4. Anonymous
    2018-05-13T18:18:50+00:00

    Tom

    Thanks again, renaming the table containing the readings to as you had named it fixed the problem. As I write this, I've already  gotten Systolic and Diastolic to work the way I wanted, going to do the same with Glucose. I see what you mean by me being bitten although I still do not understand why the expression would not work as the expressions were the same in both yours and my databases. Would having referred to my table field as [BLoodPressure]!{Systolic] have helped or would it still have been a problem? Having the table named MyTable will eventually not tell me what is in there? But it is working so may just leave it alone.

    0 comments No comments