Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query with 2 different critieria on same field 3

Status
Not open for further replies.

netrusher

Technical User
Joined
Feb 13, 2005
Messages
952
Location
US
Below is the SQL of a Query I am working on. The Pending Date Field has
criteria for is null and I also want to do a date range on the same
field. I cannot get this to work. If I use the Date Range and the criteria
I do not get the results. If I take out the date range the query works.
If I take out the is null critera the query works except of course
I get records for the Pending Date Field that I don't want because I only
want the record if that field is null.

HELP! This is driving me crazy.


Code:
SELECT ECNBCNVIPtbl.[ECN Number], ECNDetailtbl.[ECN Description], ECNBCNVIPtbl.[Release Date], ECNBCNVIPtbl.[ECN Analyst]
FROM ECNBCNVIPtbl INNER JOIN ECNDetailtbl ON ECNBCNVIPtbl.[ECNBCNVIP ID] = ECNDetailtbl.[ECNBCNVIP ID]
WHERE (((ECNDetailtbl.[Pending Date]) Between [Forms]![EcnVisualStatusFRM]![StartDateTxt] And [Forms]![EcnVisualStatusFRM]![EndDateTxt]) AND ((ECNDetailtbl.[Pending Date]) Is Null) AND ((ECNBCNVIPtbl.[Do Not Process])="yes"))
ORDER BY ECNBCNVIPtbl.[ECN Number], ECNBCNVIPtbl.[Release Date], ECNBCNVIPtbl.[ECN Analyst];
 
WHERE (ECNDetailtbl.[Pending Date] Between [Forms]![EcnVisualStatusFRM]![StartDateTxt] And [Forms]![EcnVisualStatusFRM]![EndDateTxt] OR ECNDetailtbl.[Pending Date] Is Null) AND ECNBCNVIPtbl.[Do Not Process]="yes"

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
The field can't be null AND between two dates, it's either or.
 
WHERE (ECNDetailtbl.[Pending Date]) Between [Forms]![EcnVisualStatusFRM]![StartDateTxt] And [Forms]![EcnVisualStatusFRM]![EndDateTxt] OR ECNDetailtbl.[Pending Date] Is Null) AND ECNBCNVIPtbl.[Do Not Process]="yes"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for your help!
 
OOps, my suggestion had a typo ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top