Full Version: Start date & End date
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
me_100
How to search the records by entering the "start date" & "end date" if my records have their own "start date" & "end date"?

E.g.

Project Start End
1 1/11/08 20/11/08
2 1/12/08 20/12/08
pbaldy
What records would you want returned relative to the 2 dates entered? Start date between the 2, end date between the 2, any overlap, etc.
me_100
um...
[Project] [Start date] [End date]

I want to return the Project done within the searching dates.
For say, Project 1 is from 1/11/08 to 20/11/08, so if I search 30/10/08 to 30/11/08, the result will be [Project 1,1/11/08,20/11/08]; And if I search 25/11/08 to 10/12/08, the result will be [Project 2, 1/12/08,20/12/08]

Thanks for yr patient
pbaldy
Umm, then try this, presuming you're entering the criteria on the form:

SELECT...
FROM...
WHERE EndDate Between Forms!FormName.FromDateControlName To Forms!FormName.ToDateControlName
vtd
See Allen Browne's Clashing Events/Appointments.
me_100
Why this does not work?

WHERE ((([Allowance Query].[Start date])<=[Please enter Start date]) AND (([Allowance Query].[End date])>=[Please enter End date]))
vtd
Your condition only picks up the events that cover the whole parameter range. Basically, your condition only covers 1 of the 4 cases that should be selected.

That's why I posted the link to Allen Browne's article. Did you look at it???
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.