![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Lets say I have a table ID * *AutoNumber Colour * Long Sample Data ID * * * Colour 1 * * * *255 * * * * * * * * * * (Red) 2 * * * *16711680 * * * * *(Blueish) 3 * * * *5284719 * * * * * *(Yucky green) etc I want to create a continuous form with the field "Colour" shown in the correct colour. No problem on a single form, but not so easy on a continuous form. Is this possible? Thanks Phil Phil. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
In Access 2010 you are allowed up to 50 conditional formatting. And the color picker does allow you to create/make any color for the given value. So, if you have less than 50 colors, then you can do this in a continues form. It not clear if you need/want the table, or just setting up the conditional formatting is enough of a solution here. |
#5
| |||
| |||
|
|
"Phil" wrote in message news:j9ol1e$c8d$1 (AT) speranza (DOT) aioe.org... Thanks, Albert Will look into this as I only need about a dozen colours. I was under the impression you were limited to 3 conditional formats. I presume you need to use code to get over the 3 limit. Phil |
#6
| |||
| |||
|
|
"Phil" wrote in message news:j9ol1e$c8d$1 (AT) speranza (DOT) aioe.org... Thanks, Albert Will look into this as I only need about a dozen colours. I was under the impression you were limited to 3 conditional formats. I presume you need to use code to get over the 3 limit. Phil No code is required. The limit been changed from 3 to 50. So this works much as before except you allowed 50 choices. As mentioned, the color picker is supported and you can type in the RGB values for your own custom colors if you want. |
#7
| |||
| |||
|
|
Thanks again Albert, but I don't quite see how I can set a condition like ColourCode = 16711680 then format it bluish. |
#8
| |||
| |||
|
|
"Phil" wrote in message news:j9rlde$vtl$1 (AT) speranza (DOT) aioe.org... Thanks again Albert, but I don't quite see how I can set a condition like ColourCode = 16711680 then format it bluish. You have to use the above column of color code as the conditional format expression for the column you WANT to format. (you can't use this value to drive the color for the conditional format) In your case you have a color code field = 16711680 So lets pretend we going to format the last name column based on above value: Note that for conditional format you choose here is gong to be "expression is" in place of "field value is" since I assume we not trying to format the color code column. So if we are to add a color CF for lastName, but based on [ColourCode], we choose choose "expression is" eg: [ColorCode] = 16711680 As noted you will STILL have to bring up the color picker and then enter the RGB value. So the CF will not be directly driven off the actual color value, but for only about 10-11 colors this does not matter. Also, the color picker does not and cannot accept a full decimal value as you have, and you have to split it out to a RGB values. You can use the following code for this: Dim lngColor As Long lngColor = 16711680 Debug.Print "red = " & CLng("&h" & (Mid(Hex(lngColor), 6, 2))) Debug.Print "green = " & CLng("&h" & (Mid(Hex(lngColor), 3, 2))) Debug.Print "blue = " & CLng("&h" & (Left(Hex(lngColor), 2))) So the above would give us our RGB values that you can type into the color picker. The above gives: red = 0 green = 0 blue = 255 And the reverse is to use RGB funciton eg: debug.print RGB(0,0,255) gives 16711680 So you not use the above code in the CF, but the above code is only to "convert" for use with the RGB values that you will MANAUALLY enter into the CF As noted, if this was gong to be 25 colors or some such, we might try to write some code that generates or adds or even at runtime sets the CF values, but I don't think it is worth the time for just 10 values. Convert your full decimal color vales to RGB, and then simply add the 10 values to the CF and you are done. |
#9
| |||
| |||
|
|
What I want is to show this single form as a continuous form with the AreaColour field shown in the correct colour. This colour is subsequently used for publishing different sections of advertising material, and may well be changed on a frequent basis, so it has to be done by a user rather than a programmer. Equally it is nice to be able to see all the colours at once to see how they blend. Thanks guys for all your advice. |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |