COUNTING BUSINESS DAYS!!!! HELP!!

L

Lucas

I need to count business days and create a report. I get
an error and i have no idea how to go about it. Below is
my question:

Im using this function, i made little modifications, to
count the number of business days.

Public Function CountWeekDays(SLADate As Date, DevDate As
Date) As Integer
' count the number of week days between two dates

If IsNull(DevDate) Then Exit Function

Dim CheckDate As Date
CountWeekDays = 0
CheckDate = SLADate
Do Until CheckDate > DevDate
If WeekDay(CheckDate) <> 1 And WeekDay(CheckDate)
<> 7 Then
If (CheckHoliday(CheckDate)) = 1 Then
CountWeekDays = CountWeekDays + 1
End If
End If
CheckDate = CheckDate + 1
Loop
End Function

Private Function CheckHoliday(hDate As Date) As Integer

Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("select * from
statholidays where statutory_holiday = " & "#" & hDate
& "#" & "")

If rs.EOF Then
CheckHoliday = 1
Exit Function
Else
CheckHoliday = 0
End If

rs.Close
Set rs = Nothing

End Function

I have a report and a query also. In the query i use the
above function to count the business days like this:

dateChess: CountWeekDays([datenotified],[chessentry])

Finally, inside the report i use the following to count
the number of days. I.E. how many are 0 or 1 or 3.

dcount("datechess","qzdivisionalreport","datechess = 0")

The problem is that i get an error using the DCOUNT. It's
a type mismatch error. Run-time error 62506 data type
mismatch in criteria expression.

I'm using Access 97. Doesn't it return an integer? I
tried it with a long and the same result happened.
 
Top