Hi Garyj,
I suppose u got a table like this in which the vacation is stored:
NameOfEmployee.......DateVacation
<Name1>.....................Day1ofVacation
<Name1>......................Day2ofVacation
.....
<Name1>......................lastDayOfVacationOfName1
<Name2>......................Day1ofVacationOfName2
So you could get the employees w/ >5 days of consec. vacation like this (terrible solution to programm I've to admit but it should work...):
1.) create a table w/ all days of the year(s) you want to check (01.01.03, 02.01.03,...; please make sure it is formated the same way your date in your vacation table is); add a 2nd column for a 5day period: day 1-5 would get a 1 in the 5day period column, day 6-10 a 2, 11-15 a 3,...(change this if Sat & Sun should not be considered)
2.) create a table or query w/ all the employees names (in the same 'formate' give in the Vacation tbl)
3.) create a query w/ the tables /query from 1.) & 2.) without a join. Running this query will return a list of all employees combined with every date (a timetable w/ worktime for every employee).
4.) create another query which links query 3.) with your vacation table; join
DateOf1.) => DateVacation
5.) create another query with 4.) as base which groups on the employees and on the 5dayperiods and c o u n t s the DateVacationTbl (leave the actual date colums out in this query, otherwise it wont work)
6.) create another query which returns every employee from 5.) with a 5 in CountOf_DateVacationTbl
-> the returned employees were off in some 5 day period.
7.) as special 5day periods were specified in 1.) you will have to
REPEAT 1.) to 6.) and start 5dayperiod No1 with the 2nd of Jan, then
REPEAT 1.) to 6.) an start 5dayperiod No1 with 3rd of Jan, then
REPEAT 1.) to 6.) and start 5dayperiod No1 with 4th of Jan
(no forther step because the very first 5dayperiod No2 starts with 5th of Jan)
8.) create a query which returns all employees with a "5" in one of the CountOf_DateVacationTbl's (combine the fields with an "or")
Quite complex but it should work....
HTH,
Barbarossa II