Solved Conditional formatting on a TempVar

Gasman

Enthusiastic Amateur
Local time
Today, 11:05
Joined
Sep 21, 2011
Messages
16,830
Hi all,
In my diabetes DB, the limit appears to be changing all the time. First it was 130, then 206, then 225 and finally 230.
So where I had harcoded 206 previously as the limit and show as red, I changed it to
1746096025172.png

where Tempvars("CarbLimit" is currently 230 now. I have this CF in several forms.
? tempvars("carblimit")
230

However in my crosstab view, I have suddenly discovered that it is showing red on just 26?

1746096137483.png


Anyone have any idea as to why please?
DB is available if required.

Edit: As a test I increased the breakfast amount for today, to give a larger value, and now it does not show as red? :unsure:
1746096299442.png
 
OK, I have solved it.
The expression as it was, was comparing alphabetically?, so 26 is > 230 :(
I changed it to Val() and it now shows as it should.
 
Enjoying the conversation with yourself, are ya?
 
I've noticed you use TempVars a lot. On a new project I'm working on, I use them more than I ever have, as well as table macros.

They sure make life easy and it worries me. Usually if something works well, but is not widely used, there is a reason why - a pitfall that I am unaware of.

I have considered that it could be that most of us have been using Access before they came out and that could be the reason..

At any rate, things are going well, so knock on wood!
 
Wouldn't it have been better to store the limit in a table with a DateEffective field so your data would be accurate according to what the limit was at the time?
 
Wouldn't it have been better to store the limit in a table with a DateEffective field so your data would be accurate according to what the limit was at the time?
Yes, but this is not going to happen too often, if at all.

I was told a daily carb limit of 130 when I was first diagnosed. Then I went to a presentation where they said the limit was 206 and I said Hang on a minute, that is an extra 50% to what I was initially told, so that had been my limit since then.

Now I am doing a virtual diabetes presentation and they advised to watch 4 videos prior to the first session. The first stated that the limit to keep to was 225, and then in another, 230? That is the NHS for you. :)

So I will take advantage of the higher limit and stick with that. :)
I cannot see it getting much higher TBH, else the presentations would be useless. :)

Also if I stored it in a table, I would be reading it into a TempVar at the start of the system anyway, so the comparison would be the same. However I do agree for something that would be changing regularly, that is what I would do, if that was the case.
 
CF seems to be very unpredictable when it casts values into string. It is not all the time, but under certain conditions it does. See discussion
 

Users who are viewing this thread

Back
Top Bottom