Puzzle with query expression

J

John W. Vinson

John:

That is right.

Your query functions sort of like a filter within a filter. You filter for
one set of criteria, then within that filter, you filter for another. In
your query, it working like that. The end result of it is that it return
only two records, those that have phone numbers in all four fields. It seems
that it working in reverse.

Maybe this is beyond what Access can handle.

No, Access can handle far more complex queries than this! Try getting rid of
the extra parentheses:

SELECT Addresses.Phone1, Addresses.Phone2, Addresses.Phone3,
Addresses.Phone4
FROM Addresses
WHERE Addresses.Phone1<>"N/A" AND Addresses.Phone2<>"N/A" AND
Addresses.Phone3<>"N/A" AND Addresses.Phone4<>"N/A";

Or, reverse the logic:

SELECT Addresses.Phone1, Addresses.Phone2, Addresses.Phone3,
Addresses.Phone4
FROM Addresses
WHERE NOT (Addresses.Phone1="N/A" AND Addresses.Phone2="N/A" AND
Addresses.Phone3="N/A" AND Addresses.Phone4="N/A");

John W. Vinson [MVP]
 
F

Frank

Hey John:

The following SQL code worked to perfection. It was your reverse logic that
did the trick.


SELECT Addresses.Phone1, Addresses.Phone2, Addresses.Phone3,
Addresses.Phone4
FROM Addresses
WHERE NOT (Addresses.Phone1="N/A" AND Addresses.Phone2="N/A" AND
Addresses.Phone3="N/A" AND Addresses.Phone4="N/A");


I want to express my deep appreciation for all the time and effort you spent
with me in order to resolve this sticky problem. Also, I want to give many
thanks to all of the other contributors for their enlighting comments. You
all perform a mighty service to those in need within the database cyber
community. Keep up the excellent work.

Thanks once again all for your professional assistance,

Frank
 
J

John W. Vinson

Hey John:

The following SQL code worked to perfection. It was your reverse logic that
did the trick.

That's good to know - I'm still perplexed that the other syntax didn't work!
I want to express my deep appreciation for all the time and effort you spent
with me in order to resolve this sticky problem. Also, I want to give many
thanks to all of the other contributors for their enlighting comments. You
all perform a mighty service to those in need within the database cyber
community. Keep up the excellent work.

Thanks once again all for your professional assistance,

You're welcome, and thanks for the kind words.

John W. Vinson [MVP]
 

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