Query Criteria

  • Thread starter red skelton via AccessMonster.com
  • Start date
R

red skelton via AccessMonster.com

Hi, was wondering if someone could take a look at my SQL statement and tell
me why my query isn't working. I thought this query would be straight
forward, but it doesn't work. What I'm trying to do is run the query so that
the invoices from Bourne Hall Clinic, NewCampe Medical LTD and Cox
Orthopedics are filtered out of the query results. Here is my SQL statement:

SELECT DISTINCTROW [Patient Info].[LAST NAME], [Patient Info].[FIRST NAME],
Invoices.[APPT DATE], [Patient Info].DOB, Invoices.FACILITY, Invoices.
[CONSULTANT NAME], Invoices.[RESULTS REC'D], Authorization.COMMENTS, Invoices.
[INVOICE COMMENT]
FROM [Patient Info] LEFT JOIN ([Authorization] LEFT JOIN Invoices ON
Authorization.[AUTHORIZATION NUMBER] = Invoices.[AUTHORIZATION NUMBER]) ON
[Patient Info].[PT ID] = Authorization.[PT ID]
WHERE (((Invoices.FACILITY)<>"BOURNE HALL CLINIC" Or (Invoices.FACILITY)
<>"NEWCAMPE MEDICAL LTD" Or (Invoices.FACILITY)<>"COX ORTHOPEDICS"));

Any help would be greatly appreciated.

VR,
Red
 
G

Guest

I assume that you get all the records so the where statement doesn't work.
You need to change the Or to And

SELECT DISTINCTROW [Patient Info].[LAST NAME], [Patient Info].[FIRST NAME],
Invoices.[APPT DATE], [Patient Info].DOB, Invoices.FACILITY, Invoices.
[CONSULTANT NAME], Invoices.[RESULTS REC'D], Authorization.COMMENTS,
Invoices.
[INVOICE COMMENT]
FROM [Patient Info] LEFT JOIN ([Authorization] LEFT JOIN Invoices ON
Authorization.[AUTHORIZATION NUMBER] = Invoices.[AUTHORIZATION NUMBER]) ON
[Patient Info].[PT ID] = Authorization.[PT ID]
WHERE (((Invoices.FACILITY)<>"BOURNE HALL CLINIC" And (Invoices.FACILITY)
<>"NEWCAMPE MEDICAL LTD" And (Invoices.FACILITY)<>"COX ORTHOPEDICS"));
 
R

red skelton via AccessMonster.com

Ofer,
Many thanks it worked as advertised. It is amazing how changing one word
works.
Thanks again,
Red
I assume that you get all the records so the where statement doesn't work.
You need to change the Or to And

SELECT DISTINCTROW [Patient Info].[LAST NAME], [Patient Info].[FIRST NAME],
Invoices.[APPT DATE], [Patient Info].DOB, Invoices.FACILITY, Invoices.
[CONSULTANT NAME], Invoices.[RESULTS REC'D], Authorization.COMMENTS,
Invoices.
[INVOICE COMMENT]
FROM [Patient Info] LEFT JOIN ([Authorization] LEFT JOIN Invoices ON
Authorization.[AUTHORIZATION NUMBER] = Invoices.[AUTHORIZATION NUMBER]) ON
[Patient Info].[PT ID] = Authorization.[PT ID]
WHERE (((Invoices.FACILITY)<>"BOURNE HALL CLINIC" And (Invoices.FACILITY)
Hi, was wondering if someone could take a look at my SQL statement and tell
me why my query isn't working. I thought this query would be straight
[quoted text clipped - 16 lines]
 

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

Similar Threads

Creating a sequence number 19
Can't represent the join expression 1
Query problem 6
Append Query 4
query duplication problem 1
IIf Statement 2
A query for Report 5
Please help! 3

Top