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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access query by inclusive dates

Status
Not open for further replies.

68ford

Technical User
Joined
Jun 1, 2001
Messages
3
Location
US
I have a database that is used to track sports events. I am trying to design a query that will list all events that occur within two specified dates. Also, my table has a START and END field.
The query has the following criteria on each of those fields: Between [Enter Start] And [Enter End]. My problem is this: Say I'm looking for all events that fall within the 6/4/01 and 6/9/01 window (which are the two values I use for the parameter.) If an event is scheduled 6/1/01 - 6/10/01 the query does not return that record. Even though the event itself occurs inside that requested date parameter the query ignores it. How do I remedy that?
Please note, that I'm just beginning with Access and I simply use the Query design view to modify it. If this can be solved inside the "Build" feature that would be great! I hope this question made some sense. Any help is greatly appreciated.

 
Just a guess, but the parameters start and end are being applied to 'something' besides the recorded event dates. I would 'guess' that you are applying the parameters to your fields [start] and [end], which are NOT the event dates, but the parameter dates?


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 

This query should work for you.

SELECT Events.Event, Events.StartDate, Events.EndDate
FROM Events
WHERE Events.StartDate Between [Enter Start Date] And [Enter End Date] OR Events.EndDate Between [Enter Start Date] And [Enter End Date] OR [Enter Start Date] Between Events.StartDate And Events.EndDate OR [Enter End Date] Between Events.StartDate And Events.EndDate;
Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
SELECT Table2.event, Table2.st, Table2.end
FROM Table2
WHERE (((Table2.st) Between [startd] And [endd])) OR (((Table2.end) Between [startd] And [endd]));

will do it as well.


Dave
 
Thanx for the quick help. The query is working just fine now. Thanx again!!
 

Which query is working? Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top