Results 1 to 5 of 5
  1. #1
    baba is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    43

    Color change of row based on a column value in Report

    In MsAccess 2007,I want each row color to change based on a column value in the report.



    For example: Select Name,Age,Salary from table 1 -creates 3 rows.

    Name Age Salary
    A 15 1000
    B 25 2000
    c 35 3000

    if Salary column is less than 1001,row should be in red- Row 1

    if Salary column is less than 2001,row should be in green -Row2

    if salary is less than 3001, row should be orange-Row3 .
    How to do conditional color formatting of the entire row in Msaccess2007 based on a column value of each row. Please help

  2. #2
    bcofie is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Oct 2011
    Posts
    31
    Try this,

    Open report in design view.Right click the "Salary TextBox" that displays the values and select Conditional Formatting. choose "Value is" from the drop down of Condition 1. In the adjacent text box choose >1001 and the choose a 'Fill/Back Color" from the dropdown of colors.Choose whichever color you want. Add some more conditions and do same.

    I hope this helps.
    Ben

  3. #3
    baba is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    43
    Hello Ben,
    I think your solution might change colors only for one column,I need the entire row to have color change.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    There really are no 'rows' in a report, there are controls arranged side-by-side. Apply code to each control. Can be conditional formatting or VBA code. Access2007 limits conditional formatting to 3 conditions. Access2010 upped this to 50. An alternative is unbound textbox behind each 'row' of controls and extends the full width of 'row'. Apply code to this one textbox. Another technique for alternate 'row' shading is described in http://office.microsoft.com/en-us/ac...001219146.aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    bcofie is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Oct 2011
    Posts
    31
    Yeah,
    You can set color changes for all rows. Place same condition that resulted in color change in the salary column into Name and Age Columns.
    Like this,
    when you right click and select conditional formatting on Age, Choose "Expression is" under Condition 1 and type ([Salary])>1001. In the same column, set condition 2, 3, 4 for the 2001, 3001, etc with different colors as pleased.

    Do same for Name column. You have do same for additional columns.

    Ben

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change font color in Query
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 01-10-2013, 09:14 PM
  2. Replies: 30
    Last Post: 03-01-2011, 10:05 AM
  3. Replies: 3
    Last Post: 07-05-2010, 10:46 PM
  4. Color/font change in subform
    By AndyKim in forum Forms
    Replies: 9
    Last Post: 06-24-2009, 04:34 PM
  5. change cell color
    By bishop743 in forum Programming
    Replies: 0
    Last Post: 02-01-2009, 11:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums