Query Not Working As Expected

danbl

Registered User.
Local time
Today, 02:01
Joined
Mar 27, 2006
Messages
262
I have a query which has a date range perameter (between date1 and date2) and column value 1 is -1, or column value 2 is -1, or column value 3 is -1. When I execute the query by dates, the dates are ignored and the column values are referenced. Why is the date range criteria being ignored??
 
Either the data suck, or the query code sucks, or the expectation sucks. Microsoft gnomes screw up very seldom.
 
I guess all of those are possibilities but the expectation is not. Between two dates if either of the three columns has a negative 1 value then the query should show the data. However it pulls all data regardless of the date range that is entered. So it seems that the problem is with the query not the data or the expectation. While I make no claim to be an expert, this is the code from the query.

SELECT [t_Perioperative Data].DOB, [t_Perioperative Data].Date, [t_Perioperative Data].Physician, [t_Perioperative Data].[Peroperative Indicator], [t_Perioperative Data].Q17, [t_Perioperative Data].Q18, [t_Perioperative Data].Q19, [t_Perioperative Data].Comments
FROM [t_Perioperative Data]
WHERE ((([t_Perioperative Data].Date) Between [Forms]![Date Range Form]![Start Date] And [Forms]![Date Range Form]![End Date]) AND (([t_Perioperative Data].Q17)=-1)) OR ((([t_Perioperative Data].Q18)=-1)) OR ((([t_Perioperative Data].Q19)=-1));

If you can help thantks ........
 
Last edited:
Thanks for your help Pat ..... after cutting and pasting your code into the query it worked the way I wanted. I went back to design mode to also see what impact in had there. I believe I get the drift now and will read up as you suggested. Thanks again!!
Dan
 

Users who are viewing this thread

Back
Top Bottom