Weekdays Exclusion

darno

Registered User.
Local time
Tomorrow, 02:39
Joined
May 25, 2005
Messages
67
I m new 2 access, i have a query which i simply do not know how to handle. Please if anyone can help me:

I have a form having two dates on it, First is Invoice Date and the second is delivery date. What i wish to see is that automatically the invoice date takes date from system (this part is done), and the delivery date field automatically adds 2 more days to it and excludes weekend days, saturday and sunday. for example: a date of 6 July 2006 was picked by invoice date field from system, the delivery date now should add 2 more days to it plus it must not include weekend days in it, so the resulting date in delivery date field must read 10-Jul-2006.

Regards,

Darno
 
Still I do not get what i wish...

RuralGuy said:
I'll bet you can find what you need here: A plethora of date functions

I tried your given link but no use. Please read my question carefully and help me. Anybody's help will be highly appreciated

Darno
 
Still I do not get what i wish...

RuralGuy said:
I'll bet you can find what you need here: A plethora of date functions

I tried your given link but no use. Please read my question carefully and help me. Anybody's help will be highly appreciated

Darno
 
Sorry Darno, You are correct and it's not there. Create a new standard module named basDates and put this function in it.
Code:
Public Function PlusWorkdays(dteStart As Date, intNumDays As Long) As Date

PlusWorkdays = dteStart
Do While intNumDays > 0
     PlusWorkdays = DateAdd("d", 1, PlusWorkdays)
     If Weekday(PlusWorkdays, vbMonday) <= 5 Then
[COLOR="Green"]'-- If you have a Holiday Table use the next IF instead!
'     If Weekday(PlusWorkdays, vbMonday) <= 5 And _
      IsNull(DLookup("[Holiday]", "tblHolidays", _
      "[HolDate] = #" & PlusWorkdays & "#")) Then[/COLOR]
          intNumDays = intNumDays - 1
     End If
Loop
End Function
Then depending on how you have implemented the Invoice date, you can call it like Me.[DeliveryDate] = PlusWorkdays(Me.[InvoiceDate],2) using your control names of course.

Post back if you need further assistance.
 
Darno,
Please do not post the same question in more than one forum. This other thread of yours contains additional information not contained in this thread so I'll continue on that thread.
 

Users who are viewing this thread

Back
Top Bottom