query to test if fields have the same value

Hello Experts,

I'm try to create a calculated field in a query that tests if three fields have the same value in the same records and I'm stumped.

I'm using Access 2010

Thanks
LVL 3
eshurakAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Why not do that in the WHERE clause instead ?

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Example:

SELECT Table1.*
FROM Table1
WHERE (((Table1.FIELD1)="abc") AND ((Table1.FIELD2)="abc") AND ((Table1.FIELD3)="abc"));

If not, what do you have so far?

mx
0
eshurakAuthor Commented:
The values will never be the same.

Also It needs to be a calculated field.  Something like:
Expr1: ([fld_2007]=[fld_2008])=([fld_2007]=[fld_2009])=([fld_2008]=[fld_2009])
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Not following:

"that tests if three fields have the same value "

"The values will never be the same."

?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Do you mean this:

SELECT Table1.FIELD0, IIf([FIELD1]=[FIELD2] And [FIELD1]=[FIELD2] And [FIELD2]=[FIELD3],"YES","NO") AS Expr1
FROM Table1;

mx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eshurakAuthor Commented:
Let me clarify:  the value we are looking for will never be the same.  In other words we can't test for "ABC" like you did in your second post.  The values in my fields could be any numeric combination (it is a text field as there can be leading zeros).
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
ok ... did you see my post @ http:#a37229162  ?

mx
0
eshurakAuthor Commented:
That works.  I shortened it to:

=[fld_2008]) And ([fld_2007]=[fld_2009]) And ([fld_2008]=[fld_2009])

Thanks

0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
cool.

mx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.