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

Change the font color based on a field value

Status
Not open for further replies.

Devaki

Programmer
May 23, 2001
58
0
0
US
Hi,
Is there a way to change the Color of a certain field based on the value of another field in crystal 8.5

Ex
Field A
Field B - Values 1,2,3,4,5
can i set the color of field A to be red if the corresponding records field B value is 1
Blue if value is 2 ...

Thanks
Devaki
 
Hi,
This is possible by doing the following:
right click on field a, select format field, select border tab, check the box on the bottom that says background. ignore the color that shows up in the box, select the small box that open the formula editor to the right in there you need to put the following:

if {field B}=1 then blue else if {field B}=2 then red else nocolor
etc etc etc.. (if you have more than 2 values, just keep adding the if then elses)

Hope this helps!
-Bruce
 
-Roadkill

This changes the background color, but is there anyway to specifically change the font color? Just curious :)

- David
 
Hi,
It would depend on the version of crystal you are using. I am looking at 8.5 and yes you can change font color with the same formula. what you do is:
right click on field, select font from dropdown, press the formula box to the right of the color and enter the same formula.
 
Hi !

You can do this by doing the following :-
Right click on the filed and select FONT.
Click on the buuton there for the formula box in right corner of COLOR and write the formua as

If {field B} = 1 Then
Blue
Else If {field B}=2 Then
Red
Else
Black

... This would work properly !

 
The only thing I would add is your last else statement should say:

Else DefaultAttribute

Tis way, if your default is blue text or green text or what-have-you, the failure to meet any if statements will not change the font color to black, it will keep it as the default, whatever color that may be.

The use of DefaultAttribute works in the same manner on other conditional formatting as well. Software Support for Macola, Crystal Reports and Goldmine
dgillz@juno.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top