Solved Update broke Conditional Formatting?

Gasman

Enthusiastic Amateur
Local time
Today, 20:36
Joined
Sep 21, 2011
Messages
17,256
I updated from 19029.20184 to 19029.20208 in helping a member on another forum. I have Office 2019.

Now I have discovered that my CF for a control is not working.

AFAIAA I have not modified anything for ages.

I am using an expression Val([txtCarbsCalc])>TempVars("CarbLimit"). I have quickly changed it to a Field Value > 230 and that works, however I would like to use the expression which was working fine. The Tempvar is set on the first form load.

Code:
    TempVars("CarbLimit").Value = 230              ' Carb limit has increased from 130, 206, 225 now 230
Could someone on either version please test and see if they have the same issue please?
I have checked it is set

? TempVars("CarbLimit").Value
230
 
OK, I have got it working by using the Field Value option again, but still comparing against TempVars("CarbLimit")
 
What happens if you try using bang syntax?
Code:
Val([txtCarbsCalc])>TempVars!CarbLimit
 
Spoke too soon. :(
1756033094580.png
 
What happens if you try using bang syntax?
Code:
Val([txtCarbsCalc])>TempVars!CarbLimit
Nope, does not change to Red. :(
I changed it back to Field > 230 and that still shows todays as Red when only 44.42 ?

However If I go back to previous records under 230, they are black?

1756033576870.png
 
Last edited:
I changed it back to Field > 230 and that still shows todays as Red when only 44.42 ?
Conditional formatting can tend to treat anything like text. And vba will coerce comparisions into text on the right side.
That would answer why "44.2" is greater than "230"

So I would do the calculation in the query and return true or false in a calculated control.

IsGreaterThan230: iif([do carb calculation here] > 230, True, False)

Then your CF becomes
Expression is: [IsGreaterThan230] = True

Here is an example of CF coercing to string
 
Last edited:
That would account for why 189 is black.
I am not using a query just the table and that control calculates the total carbs for the day, using DSum()
Even hardcoding 230 and Field Value option shows 44.2 as red. :(

I have never noticed this before and the day always starts off with values like that and just increments during the day.
I'll just do it in code.
 

Users who are viewing this thread

Back
Top Bottom