comboBox with different colors

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have a report in which I have a comboBox with query based values. The
values can generally be clasified into 3 different categories. I want to
somehow make this difference appear on the screen. For example, if the values
of the first category would be colored black, then the values of the second
category colored red, and the values of the third category colored black
again that would be great. Another option would be to put some separating
line between the categories, or even a blank value.
Any idea of how to do that?
BTW, the comboBox is bounded to a Table.

thank you,
 
I'm not sure if you are talking about reports ot forms

For both you can check the conditional formatting, click on the combo, then
in the menu bar select Format > conditioal formating , select the color for
each value in the combo.

If its a report, you can have another option
On the "on format" event of the section where the combo box is, you can
write the code

Select case me.comboName
case "value1"
me.comboName.BackColor = Red
case "value2"
me.comboName.BackColor = Blue
case "value3"
me.comboName.BackColor = Yellow
End select
 
You cannot apply Conditional Formatting to individual lines of the
standard Combo control. As you mentioned, you can simulate the separate
grouping design desired by the use of seperation lines, extra space
characters, etc..
A sample MDB is here:
http://www.lebans.com/justicombo.htm
specifically:
http://www.lebans.com/DownloadFiles/CboRowSeperators.zip

Another possible solution using "space" or other characters to format
individual rows is here:
http://www.lebans.com/commandbars.htm


Alternatively, you might consider using a SubForm in Continuous or
Datasheet view. Conditional formatting is supported in these form view.


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
First of all, I'm talking about a form.

It seems the formatCondition can help.
There are 2 problems: the first is it isn't working. The bounded field of
the combo is a numeric value. So I used the formatCondition and made
conditions which access is ignoring for some reason.
The second problem is I can put only three conditions, which isn't really
enough (unless there is a way puting a query in one of the conditions)
Thank you!
 
First of all, thank you.
Actually, by coincidence the comboBox is coincidently placed in a Subform in
continuous view. But, as I said, the conditional format isn't working...
 
Ok, the conditional formating is working. but, It changes the color of the
text only after a specific value has been chosen. I want that when the combo
box drops Down, some of the values will be colore red already. any way doing
this with conditional formating?
 
You can't do that, the combo wont display different colors while you presson
it and list the values, the colors will apear only after you select a value.
Sorry for that.
 
Thank you all for all of your help.
Since what I wanted to do is impossible, I used an empty value as a
separator between the categories.
 
Back
Top