OR works - AND gives zero result

maytaha

New member
Local time
Today, 10:22
Joined
Nov 12, 2012
Messages
9
Solved:OR works - AND gives zero result

I made a query that requires to enter two parameters (both are Number data type). I need the 2 parameters to be a criteria in the same row (AND). When I run the query it gives me zero result (and the data is already exists in the table). What is the mistake?:confused:
 
Last edited:
Please show the code and a sample
 
SELECT Sanctions.ID, Sanctions.Emp_name, Sanctions.decision_num_s, Sanctions.decision_year_s, Sanctions.Sanction, Sanctions.Case_num_s, Sanctions.Case_year_s, Sanctions.Case_Side, Sanctions.Notes, Sanctions.Entry_date, Sanctions.Modif_date
FROM Sanctions
WHERE (((Sanctions.decision_num_s)=[enter decision number]) AND ((Sanctions.decision_year_s)=[enter decision year]));
 

Attachments

  • sanctions1.jpg
    sanctions1.jpg
    72.8 KB · Views: 137
when i enter 1 in [decision number] and 2014 in [decision year] it gives me zero results
 

Attachments

  • sanctions2.jpg
    sanctions2.jpg
    57.4 KB · Views: 135
Does it give you the correct results if you just look up the Decision Number? In other remove the Year criteria and see if you can get it to work. If that works do the same thing with Year. My thought is it's not reading one of those fields correctly because what you have is correct.
 
YESS I removed year criteria and it worked.When I removed number criteria it didn't work. The reading problem was in the year. The problem that it was searching in the [id] field , not in [year] field
 

Attachments

  • Presentation1.jpg
    Presentation1.jpg
    98.1 KB · Views: 144
If you're testing against one field it's OR.
If you're testing against two or more fields then AND.

Are you sure you don't want OR anyway?
 
@vbaInet

AND is what is wanted but it wasn't pulling anything. I believe that was because the wrong field was being *read*. I think it's fixed now but waiting to hear back.
 
The SQL he posted does not match the Design Grid he later posted, which I think was after he fixed it following Gina's diagnostics suggestion.

Brian
 
@vbaInet

AND is what is wanted but it wasn't pulling anything. I believe that was because the wrong field was being *read*. I think it's fixed now but waiting to hear back.
Je comprends!
 

Users who are viewing this thread

Back
Top Bottom