bairdb Posted November 28, 2005 Share Posted November 28, 2005 Is it possible to conditionally format data that is being displayed in an html table from and access database? example: if a cell is greater than 100 the text turns red.ThanksBaird Link to comment Share on other sites More sharing options...
Jerome Posted November 28, 2005 Share Posted November 28, 2005 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 More sharing options...
bairdb Posted November 28, 2005 Author Share Posted November 28, 2005 Is it possible to make the condition something other than characters? Say I want it to be greater than 100%? Link to comment Share on other sites More sharing options...
Jerome Posted November 28, 2005 Share Posted November 28, 2005 What kind of data are you working with? What do you want to mesure with 100%? The length of your cell? of your table? Link to comment Share on other sites More sharing options...
bairdb Posted November 28, 2005 Author Share Posted November 28, 2005 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 More sharing options...
Jerome Posted November 28, 2005 Share Posted November 28, 2005 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?<{POST_SNAPBACK}> 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now