Conditional formatting multiple values

M

me

Can anyone help me with this one please?

I want to use conditional formatting on a text box using Access 2002.
This is something that I have done many times before. But this time I
want to use multiple values. Make the background orange if the value
is 2.1 or 3.1 or 4.1 or 5.1.

On my test the value is 2.1. If I give the instruction orange if 2.1
then it works fine. But if I give the instruction orange if 2.1 or
3.1 then it does not work.

What is the right syntax please for multiple values?

Many thanks,
Matty
 
R

Ron2006

Try this.....

Spell the test out.

change the "test" on the left to be "Expression"

In the expression write:

[myfieldname] = 2.1 or [myfieldname] = 3.1 or [myfieldname] = 4.1 or
[myfieldname] = 5.1

Ron
 
J

Josh D

It works fine in Access 2000. If you have problems with 2002 you may want to
write a small routine in VBA in the After Update event of the text box:

Private sub [yourtextBoxName]_AfterUpdate()
if [yourtextboxMame].value = 2.1 or [yourtextboxMame].value = 3.1 then
[yourtextboxMame].BackColor = 33023 ' This is a color orange
Me.refresh ' or Me.Repaint
end if
End sub
 
D

Damon Heron

In the Conditional formatting window, click the add button to add the values
that you want.

the first one would be equal to 3.1
then click "ADD"
equal to 4.1
etc.

Damon
 
M

Matty

Try this.....

Spell the test out.

change the "test" on the left to be "Expression"

In the expression write:

[myfieldname] = 2.1 or [myfieldname] = 3.1 or [myfieldname] = 4.1 or
[myfieldname] = 5.1

Ron


THANKS A MILLION. So simple but it did solve my problem.
 
R

Ron2006

Matty,
I'm glad it worked..........

===============================

Damon,
Your answer is correct but can only handle 3 tests and there are 4
values that need to be tested.

Ron
 
Top