Full Version: Change Record Background Color on a Continous Form
UtterAccess Forums > Microsoft® Access > Access Forms
I want to change the background color of a record on a continuous form based the value of the Job Status of the record.
I have set the table as follows
Table: JobStatus
JobStatusID AutoNumber
JobStatus Text
JobColor Number
I have entered the correct numbers for the colors I want for the corresponding Job Status. My problem is I don't know how to update the background color when I change the JobStatus.
Thanks in advance for the help.
Doug Steele
Use Conditional Formatting.
If I use Conditional Formatting I only have 3 conditions and I have 5 different colors I need.
Doug Steele
See whether Extending the Functionality of Conditional Formatting in Access helps.
Looks like a pretty involved process. Can't we do a little lookup to make this work.
don't know the code but it might go something like this.
RecordBackgroundColor = lookup orders.Progress.Value compare with JobStatus.ID and Set Background color Job.Color
Oknow the code is wrong but that is sort of what I had in mind.
Is this possible?
Doug Steele
As far as I know, the approach outlined in the article is the only way.
While it may look as there are, say, 40 occurrances of the text box on the form, in actual fact there's only one instance, repeated 40 times. If you use VBA code to set the backcolor for one control, it'll affect all of them.
I've usually gone with Doug's method. I haven't read the whole article but I use another technique quite often too:

Instead of your JobStatus table containing a JobColor NUMBER field, use an OLE object field. Insert a bitmap object into the OLE field and fill the bitmap with the color you want. Then include the OLEObject field in your form behind the other controls. This works great and you can be a lot more robust and visually interesting by filling the OLE bitmap object with something other than a solid color, like certain patterns or gradient colors, etc. I attached a relevant screenshot.


Edited by: JeffK on Mon Jun 15 13:50:54 EDT 2009.
and how does one get to this OLE object field ?
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.