Solved

How can I change the background colour for a specific row in a table

Posted on 2014-10-17
6
506 Views
Last Modified: 2014-10-20
How can I change the background colour for a specific row in a table, based upon the string value in one of the fields. eg If the original data in one of the tables rows is edited one of the fields will have the string Amend entered. I would then like the row in that table to be coloured orange (a simple visual indicator for the end user that something has changed.)

Please be patient with me as an access newbie..
Thanks for reading
0
Comment
Question by:mrmad1966
6 Comments
 
LVL 33

Expert Comment

by:ste5an
ID: 40386252
There is no simple way to do this.

What Access version and what kind of "table" are you talking about?
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 40386263
You cannot do this in a table, but you could do it for a record displayed in a form or a report, using conditional formatting.  This is easiest to do for a single control on your form or report, but could be extended to the entire row.  

1.  Open your continuous or datasheet form in design view.
2.  Select the control that you want to flag with this color coding
3.  On the Ribbon, click design, then Conditional Formatting from the Font section (this is in 2007), I believe there is a Format tab in the Ribbon for 2010.
4.  Where it says Condition 1, select "Expression Is"
5.  In the box to the right enter a criteria that must be met for this conditional formatting to display.  In your case this might look something like:

Right("     " & [SomeFieldName], 5) = "AMEND"

6.  Then select your background color, and click OK.

Note: in the above syntax, I added 5 spaces to the beginning of the field to ensure that there are at least 5 characters in the string being tested.
0
 
LVL 35

Expert Comment

by:PatHartman
ID: 40386781
The simplest way to do it for an entire row is to create a textbox that spans the entire row and move it behind the other controls.  Set the other controls to be transparent.  Then you can control the color of the background control and that will change the background for all the "front" controls.

This method does not work on a datasheet form but it will work on a continuous or single view form or on a report.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40388673
Pat, it will do that for all records, not a specific one.

The olde trick is to set the foreground colour of that textbox and then bind it to a function that returns Null for common records and a bunch of the White Space character for the specific record.

gustav
0
 
LVL 35

Expert Comment

by:PatHartman
ID: 40390524
Conditional formatting only affects the current record.  I guess I didn't make it clear that we were still talking about using conditional formatting.  You use the "Expression Is" option but attach it to the field you want to color rather than the field you want to examine.

I forgot about the olde trick it's been so long since I had to use it.  Too bad even that won't work for DS view.  In DS view, the only option is to colorize each control independently because you can't use the stacked controls trick.

While we're at it, it's also too bad that the conditional formatting option doesn't use theme colors.  You have to be careful so you don't conflict with the theme you are using.  The results can be jarring.
0
 
LVL 1

Author Closing Comment

by:mrmad1966
ID: 40391840
Thank you everyone.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question