Excellent that means I should be able to clearly display my problem area and get loadsa help ?!
------------------------------------------------------------
Code:Public Function Working_Date(intMonth As Integer, intYear As Integer, intDay As Integer) As Date Dim dtmBegin As Date, intCount As Integer '# Note working day function checks if the date is a weekend '# or within the bank holidays table. dtmBegin = Start_Date(intMonth, intYear) Do While Not (Is_WorkDay(dtmBegin)) '# This will take us to our first working day '# for the month in question dtmBegin = DateAdd("d", 1, dtmBegin) Loop If intDay < 0 Then '####################### ' Error is here the date is always one working day short! '####################### ' # Working Day is negative. intCount = -1 Do Until intDay = intCount 'take off a day dtmBegin = DateAdd("d", -1, dtmBegin) If Is_WorkDay(dtmBegin) Then 'if working day then reduce count intCount = intCount - 1 End If Loop Else '# Working Day is positive. '# Tested works!! intCount = 1 Do Until intDay = intCount 'add a day dtmBegin = DateAdd("d", 1, dtmBegin) If Is_WorkDay(dtmBegin) Then 'if working day then increase count intCount = intCount + 1 End If Loop End If Working_Date = dtmBegin End Function




Reply With Quote