Click here to Skip to main content
14,239,876 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to give red background to column in select statement if it less than 50 and green if it bigger than that

What I have tried:

I tried use '
' + CN + '
'

notice type CN is numeric
Posted
Updated 11-Jul-19 10:55am
Comments
Member 14160360 5-Jul-19 17:11pm
   
I wrote in what i have tried section dir because this happens this mistake
MadMyche 5-Jul-19 17:25pm
   
In what application? MS Access, Sql Studio, Crystal reports???
Member 14160360 5-Jul-19 17:27pm
   
ms access 2007
MadMyche 6-Jul-19 8:17am
   
OK, is this when looking at the table, a view, a form, or a report?
Rate this:
Please Sign up or sign in to vote.

Solution 1

It sounds like you want to use Conditional Formatting, just like Excel.

What you need to understand about Access is that there are 2 different groups of Access Object types; the SQL database objects and the User Interfaces.
The SQL objects are called Tables and Queries. These are just for data and really are not intended for regular direct user access.
The User Interface objects are Forms and Reports. As these are intended for the end users use, they are customizable either via design, code, or macros; and does have Conditional Formatting available.

Now if your intent is to change the coloring in tables or queries, it ain't happening as these are only raw data. What you can do is use a tabular form within a form which can be styled as you desire.

References:
Highlight data with conditional formatting - Access[^]
Access database - conditional formatting on a datasheet[^]
   
Comments
Maciej Los 8-Jul-19 14:31pm
   
5ed!
MadMyche 8-Jul-19 14:52pm
   
Thank you
Rate this:
Please Sign up or sign in to vote.

Solution 2

If you want to display data with conditional formatting you will need to use a form or report.
You can't use conditional formatting within SQL statement!
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100