Excluding weekends and bank holidays (1 Viewer)

thedeadzeds

Registered User.
Local time
Yesterday, 18:10
Joined
Jan 8, 2014
Messages
40
Hi Guys,

Is there a way of auto populating a date based on another date whilst excluding weekends and bank holidays?

So with regards to the attached database, can date due in frm_1 show 1 WORKING day ahead of the date input (eg date input is 14/10/15 so date due should show 15/10/15). This obviously gets tricky on a Friday (or bank holidays) as I don’t want the date to then show a Saturday for example?

Hope this makes sense?

Regards
 

Attachments

  • Date Due.zip
    23.9 KB · Views: 75

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:10
Joined
May 7, 2009
Messages
19,231
here try a made another table tblHoliday, you should fill this table with actual holidays in your area.
 

Attachments

  • Date Due.zip
    43.8 KB · Views: 77

alwazeer

Registered User.
Local time
Yesterday, 18:10
Joined
Nov 9, 2011
Messages
36
You are awesome arnelgp
How can i use Two conditions in the same code

I try But I got error (Duplicate declaration in current scope)

Code:
 Select Case B_date
 Case 1
    Const strDateToIgnore As String = "Fri/Sat"
  Case 2
    Const strDateToIgnore As String = "Fri/Sat/mon/wed"
   
   End Select
Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:10
Joined
May 7, 2009
Messages
19,231
then don't use the constant variable


Dim strDateToIgnore as string
Select Case B_date Case 1 strDateToIgnore = "Fri/Sat" Case 2 strDateToIgnore = "Fri/Sat/mon/wed" End Select
 

alwazeer

Registered User.
Local time
Yesterday, 18:10
Joined
Nov 9, 2011
Messages
36
Hi arnelgp

I fill the tblHoliday with actual holidays in My area, Put the code didn't count it

its value is zero!!
Why??

Thanks a gain
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:10
Joined
May 7, 2009
Messages
19,231
from where are you calling this function. its supposed to skip those dates, and in your case statement.
 

alwazeer

Registered User.
Local time
Yesterday, 18:10
Joined
Nov 9, 2011
Messages
36
from where are you calling this function. its supposed to skip those dates, and in your case statement.

Thanks For your Replay
i put (4) holidays in The table tblHoliday

I call it form the txtInputDate after update

But when enter it doesn't skip those dates
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:10
Joined
May 7, 2009
Messages
19,231
is it possible for you to upload your db?
 

alwazeer

Registered User.
Local time
Yesterday, 18:10
Joined
Nov 9, 2011
Messages
36
The same attach that u r upload

her is it

i fill Holidays but when go to frm_1 the code work normal without skip the Holidays
 

Attachments

  • Date Due1.accdb
    936 KB · Views: 59

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:10
Joined
May 7, 2009
Messages
19,231
here try this:
 

Attachments

  • Date Due1.accdb
    936 KB · Views: 67

alwazeer

Registered User.
Local time
Yesterday, 18:10
Joined
Nov 9, 2011
Messages
36
Thanks very much
It Works
I have question:
How can i count Friday and Saturday in the month??
 

Users who are viewing this thread

Top Bottom