Donovan Moore
asked on
Different Color Per Record on Continuous Subform
I have a continuous subform that displays records with color (RGB) data. I would like each record to display a color "chip" field whose color is based on the RGB values that are also present in each record. I have code that sets this color for each record (using the On Current method), but all records on the subform change to the current record's color value when changing records.
Is there any way to set the color by record, and have it display correctly so that the user does not have to select each individual record to see the color display?
Thanks!
I am using Access 2007, Win XP Pro (SP2).
Is there any way to set the color by record, and have it display correctly so that the user does not have to select each individual record to see the color display?
Thanks!
I am using Access 2007, Win XP Pro (SP2).
"but all records on the subform change to the current record's color value when changing records."
Which is because physically there are only one set of controls on a continuous form.
mx
Which is because physically there are only one set of controls on a continuous form.
mx
ASKER
I don't believe Conditional Formatting will work in this case. I need each color chip to use the specific RGB values per record.
I have created an image that might better explain what I'm looking for (you'll need to copy and paste):
http://s6.photobucket.com/albums/y207/SSURORG/ColorValues/Misc/?action=view¤t=ColorChipExample.jpg
Thanks again.
I have created an image that might better explain what I'm looking for (you'll need to copy and paste):
http://s6.photobucket.com/albums/y207/SSURORG/ColorValues/Misc/?action=view¤t=ColorChipExample.jpg
Thanks again.
ASKER
Sorry. Maybe this will work better:
http://i6.photobucket.com/albums/y207/SSURORG/ColorValues/Misc/ColorChipExample.jpg
http://i6.photobucket.com/albums/y207/SSURORG/ColorValues/Misc/ColorChipExample.jpg
Sorry ... I missed that ... the RGB part. I see what you mean now.
The only way I could see that being done would be controlling CF via VBA code ... which gives you a lot more flexibility that using the CF wizard.
How many different RGB combinations are we talking about here?
mx
The only way I could see that being done would be controlling CF via VBA code ... which gives you a lot more flexibility that using the CF wizard.
How many different RGB combinations are we talking about here?
mx
ASKER
"How many different RGB combinations are we talking about here?"
Hoo boy. Potentially 255 cubed. The entire sRGB255 color spectrum I suppose. Which will only get more complicated once Deep Color is instituted...4096 cubed.
I might start looking at controlling CF via VBA...if that seems plausible.
Hoo boy. Potentially 255 cubed. The entire sRGB255 color spectrum I suppose. Which will only get more complicated once Deep Color is instituted...4096 cubed.
I might start looking at controlling CF via VBA...if that seems plausible.
"I might start looking at controlling CF via VBA...if that seems plausible."
Humm .... with THAT many combinations, that could be ... interesting! Because basically, it's going to be ... If Some Condition, Display Some RGB Color. Yikes!
You *might* get some info form this:
http://www.lebans.com/conditionalformatting.htm
however, it's a different situation ... but ... you might find something useful in Steven's code.
mx
Humm .... with THAT many combinations, that could be ... interesting! Because basically, it's going to be ... If Some Condition, Display Some RGB Color. Yikes!
You *might* get some info form this:
http://www.lebans.com/conditionalformatting.htm
however, it's a different situation ... but ... you might find something useful in Steven's code.
mx
Is this a start:
Me.txtID.FormatConditions( 0).BackCol or = RGB(255,240,240)
Me.txtID.FormatConditions( 1).BackCol or = RGB(240,255,240)
Me.txtID.FormatConditions( 2).BackCol or = RGB(240,240,255)
Me.txtID.FormatConditions(
Me.txtID.FormatConditions(
Me.txtID.FormatConditions(
Ethx - what is the condition(s) the determine what the RGB color should be ?
mx
mx
Interesting - form Help:
FormatConditions Property
See AlsoApplies ToExampleSpecificsYou can use the FormatConditions property to return a read-only reference to the FormatConditions collection and its related properties.
expression.FormatCondition s
expression Required. An expression that returns one of the objects in the Applies To list.
Remarks
This property is available only by using Visual Basic.
Conditional formatting can also be set on a combo box or text box from the Conditional Formatting dialog box. The Conditional Formatting dialog box is available by clicking Conditional Formatting on the Format menu when a form is in Design view.
Example
The following example sets format properties for an existing conditional format for the "Textbox1" control.
With forms("forms1").Controls(" Textbox1") .FormatCon ditions(1)
.BackColor = RGB(255,255,255)
.FontBold = True
.ForeColor = RGB(255,0,0)
End With
FormatConditions Property
See AlsoApplies ToExampleSpecificsYou can use the FormatConditions property to return a read-only reference to the FormatConditions collection and its related properties.
expression.FormatCondition
expression Required. An expression that returns one of the objects in the Applies To list.
Remarks
This property is available only by using Visual Basic.
Conditional formatting can also be set on a combo box or text box from the Conditional Formatting dialog box. The Conditional Formatting dialog box is available by clicking Conditional Formatting on the Format menu when a form is in Design view.
Example
The following example sets format properties for an existing conditional format for the "Textbox1" control.
With forms("forms1").Controls("
.BackColor = RGB(255,255,255)
.FontBold = True
.ForeColor = RGB(255,0,0)
End With
ASKER
Thanks for the help DatabaseMX and incrediblejohn...
As far as the RGB conditions go...well, the RGB values are stored for each Color Value. I have a database with over 30,000 colors - Pantone Matching System (PMS) colors, Pantone Textiles, Pantone Goe System colors, Pantone Process Colors, Robison-Anton threads, Madeira threads, Toyo Inks, etc., etc., etc. Each color value can have a set (or multiple sets) of RGB, HTML, CIE-L*ab, CMYK, Formula Mixes, etc. information attached to it. I store multiple color spaces as well, and each color space will have different RGB colors. And, I store historical values as well.
Probably more info than you need (!)...
As far as the RGB conditions go...well, the RGB values are stored for each Color Value. I have a database with over 30,000 colors - Pantone Matching System (PMS) colors, Pantone Textiles, Pantone Goe System colors, Pantone Process Colors, Robison-Anton threads, Madeira threads, Toyo Inks, etc., etc., etc. Each color value can have a set (or multiple sets) of RGB, HTML, CIE-L*ab, CMYK, Formula Mixes, etc. information attached to it. I store multiple color spaces as well, and each color space will have different RGB colors. And, I store historical values as well.
Probably more info than you need (!)...
The problem isn't finally getting the color you want using VBA/VB in code. The problem is that the continuos forms setting only references the current record when you reference the textbox. In other words, all the other rows would go back to nothing if the record selector is not on them. You might have to build a custom grid. What you want can be done pretty easy in dynamic html. I guess you could embed a browser control in your form, hahaha
Also, there is a hack using a hidden txtBox on the header section above the detail where you could change the color of just the selected row. I've done that many times, but the other rows won't remember your colors.
You could also build a whole ton of labels in rows to fake a grid and set their bg color at runtime. Then hack a solution to edit the record (new form).
You could also build a whole ton of labels in rows to fake a grid and set their bg color at runtime. Then hack a solution to edit the record (new form).
Ethx,
I am working on a sample...
I'll keep you posted.
;)
I am working on a sample...
I'll keep you posted.
;)
ASKER
Thanks boaq2000...I appreciate it!
ASKER
Not trying to pressure, but any progress?
Thanks.
Thanks.
Oh!
:O
OK, I try to work on it a little at a time, in my spare time.
We'll say ...by Monday it should be ready.
I have some spare time this weekend
JeffCoachman
:O
OK, I try to work on it a little at a time, in my spare time.
We'll say ...by Monday it should be ready.
I have some spare time this weekend
JeffCoachman
ASKER
No problem...again, I appreciate your help!
ASKER
Just bumpin' this one up again...
Opps benn busy at work
Umm, let's say Monday?
Umm, let's say Monday?
ASKER
No problem!
ASKER
Just checking in again...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
here is the basic info
First ... a short tutortial
http://www.simply-access.com/ConditionalFormattingIntroduction.html
In VBA code:
http://msdn2.microsoft.com/en-us/library/aa139965(office.10).aspx
And then from the Access Help File:
--------------------------