Query with three criterias

mulberry13

Board Regular
Joined
Nov 23, 2005
Messages
204
I have a query that I pull a report of new referrals. It works fine but we are finding children who discharged but then were 're opened" with a new start date.
The first criteria is: Start Date which I entered >6/30/2011
The second criteria is: in the "or" line with a "re opened dt" >6/30/2011
both of these run fine but now I need to filter out Armstrong County from Westmoreland County and when I add <> Armstrong County, it still gives me all counties.
Can you tell me what I am doing wrong?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Could you post the SQL for the query please, will make it easier to debug the problem.
 
Upvote 0
By the way the criteria should be:

> #6/30/2011#
> #6/30/2011#

<> "Armstrong County"

If the date fields are date datatypes then you need the octothorpes (#) and if they are text you need quotes instead. And for the county you need quotes if it is text, which I assume it is. But that may not be the case if you have a lookup field set in that table (which would be not so good).
 
Upvote 0
SELECT tblClients.LastName, tblClients.FirstName, tblClients.[Active Status], tblClients.KidsKlubStartDt, tblClients.KidsKlubDischargeDt, tblClients.KidsKlub_Re_Open_DT, tblClients.Initial_Survey_completed, tblClients.Discharge_Survey_Done, tblClients.[County Code]
FROM tblClients
WHERE (((tblClients.KidsKlubStartDt)>#6/30/2011#) AND ((tblClients.[County Code]) Like "West")) OR (((tblClients.KidsKlub_Re_Open_DT)>#6/30/2011#));
 
Upvote 0
I think you need to add the wildcard to your LIKE:

WHERE (((tblClients.KidsKlubStartDt)>#6/30/2011#) AND ((tblClients.[County Code]) Like "West*")) OR (((tblClients.KidsKlub_Re_Open_DT)>#6/30/2011#));
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top