# MS Access Comparing 3 Values

E

#### eddie1209

Hello all,

I need to compare 3 values in MS Access and when they are all the same it should say true, if even 1 is incorrect it should say false.

Can anyone help me with a formula?

Below is an example.

Value 1 | Value 2 | Value 3

2 | 2 | 1 False
3 | 3 | 3 True
| | 1 False
2 | | 2 False

Edward

J

#### John W. Vinson

Hello all,

I need to compare 3 values in MS Access and when they are all the same it should say true, if even 1 is incorrect it should say false.

Can anyone help me with a formula?

Below is an example.

Value 1 | Value 2 | Value 3

2 | 2 | 1 False
3 | 3 | 3 True
| | 1 False
2 | | 2 False

Edward
(Value1=Value2 AND Value1=Value3)

--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/

E

#### eddie1209

Hey John,
Thanks for your reply! I tried this already. But then i only get the values 0 and-1

B

#### Bob Barrows

John said:
(Value1=Value2 AND Value1=Value3)
Shouldn't that be
(Value1=Value2 AND Value2=Value3)
?

E

#### eddie1209

Tried them both and I am still getting -1 and 0 as a result. Do I have to make another column to turn these values into true and false?

J

#### John W. Vinson

Tried them both and I am still getting -1 and 0 as a result. Do I have to make another column to turn these values into true and false?
-1 IS True, and 0 IS false. That's how they're stored in Access.

If you want the words "True" and "False" you can use

IIF(Value1 = Value2 AND Value2 = Value3, "True", "False")

The equality test just needs to compare either of the possible pairings. If
Value1 = Value2 and Value2 = Value3, then it is an absolute certainty that
Value1 = Value3; two things that are both equal to a third thing are equal to
each other.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/

B

#### Bob Barrows

Bob said:
Shouldn't that be
(Value1=Value2 AND Value2=Value3)
?
Duh! Of course it doesn't matter <whacks forehead in disgust>