Two date ranges, one query?

Bloodrayne

Newbie-rrific!
Local time
Today, 23:44
Joined
Oct 6, 2004
Messages
58
Hello all,

Straight into the question, before I confuddle myself more....

There are two date fields, date requested and date booked - I need it to be so that when the user enters the date range - both of the fields are checked independantly, and the relevant records are processed..

This means that if a flight is researched late September, but not booked until mid-October - the booked section will cause the record to be processed with the month of October.

Sorry if this isn't too clear, I'm still trying to figure out how to describe it to myself...

:confused:
 
I think it will be much easier to split these into two separate queries, then the user will not get confused

But anyway,

say the user types the date ranges into a form with text boxes called 'startdate' and 'enddate' and the form is called 'form1'

SELECT *
FROM table
WHERE
(DateRequested BETWEEN forms!form1!startdate AND forms!form1!enddate)
OR
(DateBooked BETWEEN forms!form1!startdate AND forms!form1!enddate)
 
Thanks for that - I won't have time to try it just yet though.

As for splitting them into two seperate queries, I've thought about that too - it'd certainly have saved me a headache....

I shall report back tomorrow with my findings...
 
Right... it does look (code-wise) like the very thing I couldn't think of yesterday, however - where in the Query am I meant to type such things?

Cheers
 
What SQL_HELL is showing you is the SQL created by your query, you can create queries directly using SQL or using the query grid. You can see the SQL creted by clicking the option on the view icon.
You can type the Between etc in the criteria row.

Brian
 

Users who are viewing this thread

Back
Top Bottom