Looking for a better/easier routine tol generate a date back including weekends just using an ending date and the number of days back:

Currently using:

Function CalcBegDateTime(dtmLastDate As Date, iDaysBack As Integer) As Date
'Calc an estimated Beginning Date

Dim dtmEstBegDate As Date
Dim iNumWeekDays As Integer
Dim iTotWeekEndDays As Integer

'Get an approximate date from Days Back
dtmEstBegDate = DateAdd("d", -iDaysBack, dtmLastDate)

'Determine total weekend days, if > Week
If iDaysBack > 6 Then
'Next determine number weekdays in this period
iNumWeekDays = HowManyWeekDays(dtmEstBegDate, dtmLastDate) '<<<Function

iTotWeekEndDays = (iDaysBack - iNumWeekDays) * 2

'Subtract weekend days from EstBegDate to get a final begin date
dtmEstBegDate = DateAdd("d", -iTotWeekEndDays, dtmEstBegDate)
End If

'Add time and Return
CalcBegDateTime = CombineDateTime(dtmEstBegDate, #12:00:00 AM#) '<<<Function

End Function

Thanks
David