From: Irshad Alam on 17 May 2010 00:54 I want to do a solution to find total working days inbetween 2 dates where Friday is the only holiday in a week, on a form following are the fields : StartDate - To enter the start date EndDate - To enter the end date WorkingDays - To obtain the result of the total working days except fridays TotalFriday - To obtain how many friday are inbetween these two dates Please advice code for the above solution. Thanking you all in advance. Regards Irshad
From: XPS35 on 17 May 2010 02:20 =?Utf-8?B?SXJzaGFkIEFsYW0=?= wrote: > > I want to do a solution to find total working days inbetween 2 dates where > Friday is the only holiday in a week, on a form following are the fields : > > > StartDate - To enter the start date > EndDate - To enter the end date > > WorkingDays - To obtain the result of the total working days except fridays > TotalFriday - To obtain how many friday are inbetween these two dates > > Please advice code for the above solution. > > Thanking you all in advance. > > Regards > > Irshad > The best way to do this is to create a function that performs the calculation. A function to calculate working days would look like: Function WorkingDays(StartDate As Date, EndDate As Date) As Integer Dim CurDate As Date Dim DayCount As Integer CurDate = StartDate DayCount = 0 While CurDate <= EndDate If DatePart("w", CurDate) <> 6 Then DayCount = DayCount + 1 End If CurDate = DateAdd("d", 1, CurDate) Wend WorkingDays = DayCount End Function Changing the condition of the if-statement will do the job for a TotalFriday function. -- Groeten, Peter http://access.xps350.com
From: Arvin Meyer [MVP] on 17 May 2010 07:37 Here's something I wrote a few years back. You will have to alter it slightly for Fridays: http://www.mvps.org/access/datetime/date0006.htm -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.accessmvp.com http://www.mvps.org/access "Irshad Alam" <IrshadAlam(a)discussions.microsoft.com> wrote in message news:6ABF0FC8-226F-41D2-B362-81CB93DA2F0A(a)microsoft.com... >I want to do a solution to find total working days inbetween 2 dates where > Friday is the only holiday in a week, on a form following are the fields : > > > StartDate - To enter the start date > EndDate - To enter the end date > > WorkingDays - To obtain the result of the total working days except > fridays > TotalFriday - To obtain how many friday are inbetween these two dates > > Please advice code for the above solution. > > Thanking you all in advance. > > Regards > > Irshad >
|
Pages: 1 Prev: updating table from recrodset Next: Use DB for a limitated period of time |