Help with between dates query?

  • Thread starter Thread starter Darren \(at work\)
  • Start date Start date
D

Darren \(at work\)

Hi,
I have the following query:

========= Begin Code ==================
SELECT parts_inspected.sample_date, parts_inspected.identification_no,
parts_inspected.[Item No], itemlist.[Item Name], itemlist.[Item
Description], parts_inspected.Inspector
FROM itemlist INNER JOIN parts_inspected ON itemlist.[Item No] =
parts_inspected.[Item No]
WHERE (((parts_inspected.sample_date) Between [Enter first date] And [Enter
second date]) AND ((itemlist.[Item Description]) Like "[*]*")) OR
(((parts_inspected.Inspector)="Keith Foster" Or
(parts_inspected.Inspector)="Colin Pennie"));
========= End Code ===================

I have used the query without the following part and it works fine:

========= Begin Code ==================

Between [Enter first date] And [Enter second date]

========= End Code ===================

My problem is that when the two parameter values are entered, for example
'04/04/2003' and '25/06/2003' (without the quotes) I still get dates outside
those values.

Any ideas anyone?

Regards
Darren
 
Hehe, this is good, I post a question then anwser it myself, lol.
Found the answer was in my logic contained in the SQL string.

Sorry about that guys :-)

Darren

--
******************************
lose YOURSELF from email to reply. *
******************************
Darren (at work) said:
PS: If I run the query to just search between the two parameter values, it
DOES return only the values within those parameters.



--
******************************
lose YOURSELF from email to reply. *
******************************
Darren (at work) said:
Hi,
I have the following query:

========= Begin Code ==================
SELECT parts_inspected.sample_date, parts_inspected.identification_no,
parts_inspected.[Item No], itemlist.[Item Name], itemlist.[Item
Description], parts_inspected.Inspector
FROM itemlist INNER JOIN parts_inspected ON itemlist.[Item No] =
parts_inspected.[Item No]
WHERE (((parts_inspected.sample_date) Between [Enter first date] And [Enter
second date]) AND ((itemlist.[Item Description]) Like "[*]*")) OR
(((parts_inspected.Inspector)="Keith Foster" Or
(parts_inspected.Inspector)="Colin Pennie"));
========= End Code ===================

I have used the query without the following part and it works fine:

========= Begin Code ==================

Between [Enter first date] And [Enter second date]

========= End Code ===================

My problem is that when the two parameter values are entered, for example
'04/04/2003' and '25/06/2003' (without the quotes) I still get dates outside
those values.

Any ideas anyone?

Regards
Darren
 
Back
Top