It seems you wish to detect even partial overlap:
SELECT *
FROM somewhere
WHERE [parameterStartDate] <= EndDate AND [parameterEndDate] >= StartDate
Hoping it may help
Vanderghast, Access MVP
> Hi Michel,
>
[quoted text clipped - 50 lines]
>> > Thanks
>> > Chi
Chi - 29 Nov 2007 14:21 GMT
Good Morning Michel,
I very appreciate for all your help! I will try to it now. And let you know
what I get.
------------------
Actually, I would like to know how many students currently in the class.
Since they are come and go at different times, it is hard to fix it out who
are still in class at period of time or now.
startdate EndDate
Student 1 01/15/07 12/15/07
> > Student2 02/16/07 05/01/08
> > Student3 04/01/06 04/01/07
> > Student4 01/01/06 01/14/07
Ex: I would like to know who are still in class now (11/29/07) or at
between 01/15/07 and 12/15/07?
Again I will apply your last response first and let you know.
Thank you so much!
Chi
> It seems you wish to detect even partial overlap:
>
[quoted text clipped - 59 lines]
> >> > Thanks
> >> > Chi
Chi - 29 Nov 2007 17:10 GMT
Hi Michel,
Perfect!!!!! It works well after inserting your code to the SQL place!
---------------
I have another question, please. Since I created a combo box to choose the
Department names, the WHERE section is more complicates. Therefore, when I
ran the query, I got the error message " too complex or the expression is
typed incorrectly." Please see the code below. Thank you so much!
WHERE (((Conjuntion.Department)=Forms!frmDepartmentDateRange!Combo0)) &
[Between this date]<=EndDate And [And this date]>=StartDate;
--------------------------------------------
I added the "&" on it. Do you think that causes the problem?
Again, your code works perfectly without the combo box.
--------------------------------------------------------------------------------
> It seems you wish to detect even partial overlap:
>
[quoted text clipped - 59 lines]
> >> > Thanks
> >> > Chi
Michel Walsh - 29 Nov 2007 18:17 GMT
should use AND, not &
WHERE (((Conjuntion.Department)=Forms!frmDepartmentDateRange!Combo0)) AND
[Between this date]<=EndDate And [And this date]>=StartDate;
Hoping it may help,
Vanderghast, Access MVP
> Hi Michel,
>
[quoted text clipped - 83 lines]
>> >> > Thanks
>> >> > Chi
Chi - 29 Nov 2007 19:44 GMT
Hi Michel,
Thanks for all your help. I got my last question.
> It seems you wish to detect even partial overlap:
>
[quoted text clipped - 59 lines]
> >> > Thanks
> >> > Chi