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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

font condition error

Status
Not open for further replies.

mart10

MIS
Nov 2, 2007
394
GB
I am using CR 2008

I have a number which I want to colour format if the last 4 digits are zero

Something like I am putting in format font condition:

If Right({FXRates.SpotAskRate},4)="0000" then crRed else crBlue

But it says A string is required here, what do I do?
 
Convert it to text, then use the Right function:

If Right(totext({FXRates.SpotAskRate},"#",0),4)="0000" then crRed else crBlue
 
It doesnt give any error no but when testing it doesnt work, stays constantly blue no matter what no I put in the formula
 

Create a test formula and put it in the details:

Right(totext({FXRates.SpotAskRate},"#",0),4)

See if it equates to '0000' for the appropriate records. If it doesn't, then you'll have to tweak the formula. For instance, there may be spaces at the end.

 
Instead of converting it to text, why not keep it as a number...

If int((((xx/10000)-truncate(xx/10000)) *10000) = 0 then crRED else crBLUE (where xx = your field)

This would be true for 12340000 but also 12340000.99865, if you want it to be false if it has a decimal then take away the Int portion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top