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

[b]Conditional Formatting[/b]

Status
Not open for further replies.

blindlemonray

Technical User
Nov 24, 2003
130
GB
I would like to set the forecolour on a report to red if the value of the text box is less then 0 i.e. -56%.... is the code something like

Code:
if me.textbox <0 then me.textbox.forecolor = vbRed
or
Code:
if me.textbox <0 then me.textbox.forecolor = RGB(255,0,0)

I hav looked at a lot of threads but i still seem to be getting the error code

The expression you have entered has no value.

Any suggestions much appreciated.
 
Hi!

If you select the text box in design view and then go to the Format drop down menu and select Conditiional Formatting you can do this without code.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Thanks Jebry didn't know that was there which is cool, but it does not work for minus figures which is what i need it for i.e -0.287. For some reason it does not think that -0.287 is less then 0!

Any Ideas??
 
Hi!

I'm not sure what is happening here. I tried it in a sample database I have and it works fine there. It sounds like somewhere the decimal is being rounded, but it shouldn't be happening in the Conditional Formatting and, if it was happening earlier, then you should be seeing 0% instead of -28.7. What does your report look like?



Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top