Solved

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

Posted on 2014-10-17
6
509 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

861 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