Function CalcWkDays5(dteStartDate As Date) As Integer
'input: (from debug window) ? CalcWkDays5(#05/05/03#)
'output: 20
'NOTE:As written,this counts both start and end dates.
Dim n As Integer
Dim dteEndDate As Date
'calculate last day of month
dteEndDate = DateSerial(Year([dteStartDate]), Month([dteStartDate]) + 1, 0)
n = 0
Do While dteStartDate <= dteEndDate
'17 in the following expression represents the numeric
'days of week for Sunday(1) and Saturday (7)
n = n + IIf(InStr("17", WeekDay(dteStartDate)) = 0, 1, 0)
dteStartDate = dteStartDate + 1
Loop
CalcWkDays5 = n
End Function