RobinHood786
Technical User
Hi all,
I’ve been using Michael Red's faq181-261 'Calculate working days between two dates working days' function for a while and it’s proved to be a very useful tool, so can I firstly say thank you to Michael Red for posting his solution.
Using this model I’ve created a sort of makeshift calendar that shows the number of working days alongside the actual day count so users can ensure they’re not booking appointments on non working days. Here’s the SQL from the underlying query of the form.
SELECT Date()+[TblDays]![Days] AS FullDate, TblDays.Days, DeltaDays(Date(),[FullDate]) AS [Working Days]
FROM TblDays
ORDER BY TblDays.Days;
TblDays.Day is purely a count of days (0,1,2,3…. ) that the user can manage and thereby reduce or increasing the calendar period.
I’m having a few problems and would appreciate some help or guidance.
In this example my holidays are;
HoliDate HoliName
07/06/2007 Test 1
20/06/2007 Test 2
21/06/2007 Test 3
10/07/2007 Test 4
11/07/2007 Test 5
The results I receive after running the query for 41 days (0 + 40) are shown below. (Date() is 06/06/2007)
FullDate Days Working Days
Wed, 6 Jun, 2007 0 1
Thu, 7 Jun, 2007 1 2
Fri, 8 Jun, 2007 2 3
Sat, 9 Jun, 2007 3 3
Sun, 10 Jun, 2007 4 3
Mon, 11 Jun, 2007 5 4
Tue, 12 Jun, 2007 6 5
Wed, 13 Jun, 2007 7 6
Thu, 14 Jun, 2007 8 7
Fri, 15 Jun, 2007 9 8
Sat, 16 Jun, 2007 10 8
Sun, 17 Jun, 2007 11 8
Mon, 18 Jun, 2007 12 9
Tue, 19 Jun, 2007 13 10
Wed, 20 Jun, 2007 14 10
Thu, 21 Jun, 2007 15 10
Fri, 22 Jun, 2007 16 11
Sat, 23 Jun, 2007 17 11
Sun, 24 Jun, 2007 18 11
Mon, 25 Jun, 2007 19 12
Tue, 26 Jun, 2007 20 13
Wed, 27 Jun, 2007 21 14
Thu, 28 Jun, 2007 22 15
Fri, 29 Jun, 2007 23 16
Sat, 30 Jun, 2007 24 16
Sun, 1 Jul, 2007 25 16
Mon, 2 Jul, 2007 26 17
Tue, 3 Jul, 2007 27 18
Wed, 4 Jul, 2007 28 19
Thu, 5 Jul, 2007 29 20
Fri, 6 Jul, 2007 30 20
Sat, 7 Jul, 2007 31 20
Sun, 8 Jul, 2007 32 20
Mon, 9 Jul, 2007 33 21
Tue, 10 Jul, 2007 34 22
Wed, 11 Jul, 2007 35 23
Thu, 12 Jul, 2007 36 24
Fri, 13 Jul, 2007 37 25
Sat, 14 Jul, 2007 38 25
Sun, 15 Jul, 2007 39 25
Mon, 16 Jul, 2007 40 26
As you can see I’m not quite getting the desired results in some instances.
Firstly, does anybody have suggestions as to how I can remedy the above?
Secondly, how would I amend Michael's code so that that current date is not included in the working day count. In the above example that would mean Wed 6 June 2007 would be 0 workings Days.
I hope I've explaied my queries subut please
Hope I’ve explained my questions sufficiently well but let me know if further clarification is needed.
Thanks in advance for any assistance.
Regards
I’ve been using Michael Red's faq181-261 'Calculate working days between two dates working days' function for a while and it’s proved to be a very useful tool, so can I firstly say thank you to Michael Red for posting his solution.
Using this model I’ve created a sort of makeshift calendar that shows the number of working days alongside the actual day count so users can ensure they’re not booking appointments on non working days. Here’s the SQL from the underlying query of the form.
SELECT Date()+[TblDays]![Days] AS FullDate, TblDays.Days, DeltaDays(Date(),[FullDate]) AS [Working Days]
FROM TblDays
ORDER BY TblDays.Days;
TblDays.Day is purely a count of days (0,1,2,3…. ) that the user can manage and thereby reduce or increasing the calendar period.
I’m having a few problems and would appreciate some help or guidance.
In this example my holidays are;
HoliDate HoliName
07/06/2007 Test 1
20/06/2007 Test 2
21/06/2007 Test 3
10/07/2007 Test 4
11/07/2007 Test 5
The results I receive after running the query for 41 days (0 + 40) are shown below. (Date() is 06/06/2007)
FullDate Days Working Days
Wed, 6 Jun, 2007 0 1
Thu, 7 Jun, 2007 1 2
Fri, 8 Jun, 2007 2 3
Sat, 9 Jun, 2007 3 3
Sun, 10 Jun, 2007 4 3
Mon, 11 Jun, 2007 5 4
Tue, 12 Jun, 2007 6 5
Wed, 13 Jun, 2007 7 6
Thu, 14 Jun, 2007 8 7
Fri, 15 Jun, 2007 9 8
Sat, 16 Jun, 2007 10 8
Sun, 17 Jun, 2007 11 8
Mon, 18 Jun, 2007 12 9
Tue, 19 Jun, 2007 13 10
Wed, 20 Jun, 2007 14 10
Thu, 21 Jun, 2007 15 10
Fri, 22 Jun, 2007 16 11
Sat, 23 Jun, 2007 17 11
Sun, 24 Jun, 2007 18 11
Mon, 25 Jun, 2007 19 12
Tue, 26 Jun, 2007 20 13
Wed, 27 Jun, 2007 21 14
Thu, 28 Jun, 2007 22 15
Fri, 29 Jun, 2007 23 16
Sat, 30 Jun, 2007 24 16
Sun, 1 Jul, 2007 25 16
Mon, 2 Jul, 2007 26 17
Tue, 3 Jul, 2007 27 18
Wed, 4 Jul, 2007 28 19
Thu, 5 Jul, 2007 29 20
Fri, 6 Jul, 2007 30 20
Sat, 7 Jul, 2007 31 20
Sun, 8 Jul, 2007 32 20
Mon, 9 Jul, 2007 33 21
Tue, 10 Jul, 2007 34 22
Wed, 11 Jul, 2007 35 23
Thu, 12 Jul, 2007 36 24
Fri, 13 Jul, 2007 37 25
Sat, 14 Jul, 2007 38 25
Sun, 15 Jul, 2007 39 25
Mon, 16 Jul, 2007 40 26
As you can see I’m not quite getting the desired results in some instances.
Firstly, does anybody have suggestions as to how I can remedy the above?
Secondly, how would I amend Michael's code so that that current date is not included in the working day count. In the above example that would mean Wed 6 June 2007 would be 0 workings Days.
I hope I've explaied my queries subut please
Hope I’ve explained my questions sufficiently well but let me know if further clarification is needed.
Thanks in advance for any assistance.
Regards