Jump to content

Conditional Format data from an access database


bairdb

Recommended Posts

Yes, you just need to add your condition :

If Len(yourData) > 100 Then       Response.Write("<font color=""red"">" & yourData & "</font>")Else      Response.Write(yourData)End If

If your data has more than 100 caracters, then it is displayed in red, else in the (default) black.

Link to comment
Share on other sites

What I am trying to do is I have a database that has percentages for the values. And when I display the data if the number from the database is greater than 100% I want it to turn red and if it is less than 100% I want it to turn green. Is it even possible?

Link to comment
Share on other sites

What I am trying to do is I have a database that has percentages for the values.  And when I display the data if the number from the database is greater than 100% I want it to turn red and if it is less than 100% I want it to turn green.  Is it even possible?

Yes it's possible,To display your datas from your access database, I assume you will use a loop condition. During the loop you will just have to check for every value if it's greater or smaller than 100. According to the result, you put the data in red or in green... Let's say you have a RecordSet object called Rs :
Do While Not Rs.EOF If Rs("yourData") > 100 Then     Response.Write("<font color=""red"">" & Rs("yourData") & "</font><br>")Else     Response.Write("<font color=""green"">" & Rs("yourData") & "</font><br>")End IfRs.MoveNextLoop

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...