Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional format doesn't work above 100! 1

Status
Not open for further replies.

Smoothcat74

Technical User
Aug 29, 2008
40
Hi there,

I am baffled by this one and can't figure it out. I added a conditional format to a text box control on a report which sets the text colour to red if the field value is below 123. When I swith to report view, the conditional format does not work (text remains black.)

If I chance the format variable to any value below 100, it works like a charm.

Someone please help! I know this must be something simple but it is driving me crazy!
 
What is your actual conditional expression ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Using the Conditional Format wizard, I've set condition 1 as "Field Value Is", "less than", "123". It only works if I change the value to 99.
 
I'd try something like this:
"Expression is", "Val([your field])<123"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Using the Conditional Format wizard, I've set condition 1 as "Field Value Is", "less than", "123". It only works if I change the value to 99.
"123" is a text value.
99 is numeric.
Try changing "123" to 123.


Randy
 
How are ya SmoothCat74 . . .

You can also use [blue]VBA[/blue] for this. Remove your current conditional formatting, then in the [blue]On Format[/blue] event of the [blue]Detail Section[/blue], copy/paste the following:
Code:
[blue]   If Me![[purple][B][I]ControlName[/I][/B][/purple]] < 123 Then
      Me![[purple][B][I]ControlName[/I][/B][/purple]].BackColor = 65535    'Yellow
   Else
      Me![[purple][B][I]ControlName[/I][/B][/purple]].BackColor = 16777215 'White
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
What seems to be the problem here, is that either your field or your condition is of datatype text (or most likely both?). Comparisons between text follow different rules than comparisons between numerics.

You could try that out a bit in the immediate pane (ctrl+g), for instance, check the result of the following

? "10000" < "9"
? 10000 > 9

If this field is defined as text, or perhaps you're using the format function on the field in the query (the format function returns strings), I would suggest changing to numeric or drop the format function in the query, if you need to either perform math on the field or such comparisons.

Roy-Vidar
 
PHV, thanks very much. Changing it to the Expression worked like a charm! Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top