?
Solved

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

Posted on 2014-10-17
6
Medium Priority
?
519 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 35

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 48

Accepted Solution

by:
Dale Fye earned 2000 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 38

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
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 
LVL 51

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 38

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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this article, we’ll look at how to deploy ProxySQL.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

764 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