ComboBox w/more then three Condition Codes

M

MABecker

• OK! I am kind of new to access but not total ignorant to VB or coding. I
am trying to conditional code a combo box – I know that you can use the built
in “limit 3†conditional coding. That worked fine when I only required three
or less conditions. Now I was asked to make it six conditions. What is the
Code? For some reason I just can not get it started correctly. What I have
is a combo box labeled “Color code†with a drop down of six different colors:
Red, Blue, Brown, Green, Yellow and Orange. What I need is the color of the
box to change when the word of the box changes. For example when the word
changes to Blue the background of the box changes to blue. Sounds simple
enough – I have been searching the net for a few days – while it gives great
examples of combo box multi conditional formats I can not seem to find
something direct and to the point without a lot of non-sense. Yes - I did
read many such Technical Article such as - Extending the Functionality of
Conditional Formatting in Access. With very much appreciation, thanks Mike
P.S. forgive me if I posted this in the wrong Category.
 
L

Linq Adams via AccessMonster.com

Is the form Single View, Continuous View or Datasheet View?
 
T

trevorC via AccessMonster.com

Try this,
Make a table that holds the color names for one field and another field to
hold the value (number) for that color. In the AfterUpdate condition of your
COMBOBOX put code to lookup the color and select the correct value for this
color, then set the back color of your combo box to this. Or anything else.

You can get the color values from a form design field, change the color then
get the value from the properties box.

table has 2 fields
color and value

form code example
1 COMBOBOX

Private Sub COMBOBOX_AfterUpdate()
Me.COMBOBOX.BackColor = DLookup("[value]", "[colors]", "[color]=forms!
YOURFORM!COMBOBOX")
End Sub

regards
TrevorC
 
L

Linq Adams via AccessMonster.com

The question is still, is the form Single View, Continuous View or Datasheet
View? The posted code will only work in Single View.
 
T

trevorC via AccessMonster.com

The code was tested and works with single and Continuous Forms, but not
datasheet view.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top