Hoopsah
05-29-2009, 06:29 AM
Hi,
I run a program from my machine and it works perfectly, I tried it from a colleagues machine and it works perfectly, unfortunately a further colleague runs the program and gets a run time, type mismatch error.
On debug it comes up at the following script:
Private Function CalculateMonthDays(ByVal StartDate As Date, _
ByVal EndDate As Date, _
ByVal FromDate As Date, _
ByVal ToDate As Date) As Long
If (StartDate >= FromDate And StartDate <= ToDate) Or _
(EndDate >= FromDate And EndDate <= ToDate) Then
If FromDate > StartDate Then StartDate = FromDate
If ToDate < EndDate Then EndDate = ToDate
CalculateMonthDays = wsAbsence.Evaluate("NETWORKDAYS(" & cLng(StartDate) & "," & CLng(EndDate) & ")")
End If
End Function
Private Function CalculateWeekDays(ByVal StartDate As Date, _
ByVal EndDate As Date, _
ByVal FromDate As Date, _
ByVal ToDate As Date) As Long
If (StartDate >= FromDate And StartDate <= ToDate) Or _
(EndDate >= FromDate And EndDate <= ToDate) Then
If FromDate > StartDate Then StartDate = FromDate
If ToDate < EndDate Then EndDate = ToDate
CalculateWeekDays = wsAbsence.Evaluate("NETWORKDAYS(" & CLng(StartDate) & "," & CLng(EndDate) & ")")
End If
End Function
it stops on the particular line
CalculateMonthDays = wsAbsence.Evaluate("NETWORKDAYS(" & cLng(StartDate) & "," & CLng(EndDate) & ")")
Would anyone know the reason this happens on only 1 machine?
Is there anything I can do to correct the error?
Incidentally, it occurs when the number being input is 0.5 don't know if that makes a difference.
Any help appreciated :dunno
I run a program from my machine and it works perfectly, I tried it from a colleagues machine and it works perfectly, unfortunately a further colleague runs the program and gets a run time, type mismatch error.
On debug it comes up at the following script:
Private Function CalculateMonthDays(ByVal StartDate As Date, _
ByVal EndDate As Date, _
ByVal FromDate As Date, _
ByVal ToDate As Date) As Long
If (StartDate >= FromDate And StartDate <= ToDate) Or _
(EndDate >= FromDate And EndDate <= ToDate) Then
If FromDate > StartDate Then StartDate = FromDate
If ToDate < EndDate Then EndDate = ToDate
CalculateMonthDays = wsAbsence.Evaluate("NETWORKDAYS(" & cLng(StartDate) & "," & CLng(EndDate) & ")")
End If
End Function
Private Function CalculateWeekDays(ByVal StartDate As Date, _
ByVal EndDate As Date, _
ByVal FromDate As Date, _
ByVal ToDate As Date) As Long
If (StartDate >= FromDate And StartDate <= ToDate) Or _
(EndDate >= FromDate And EndDate <= ToDate) Then
If FromDate > StartDate Then StartDate = FromDate
If ToDate < EndDate Then EndDate = ToDate
CalculateWeekDays = wsAbsence.Evaluate("NETWORKDAYS(" & CLng(StartDate) & "," & CLng(EndDate) & ")")
End If
End Function
it stops on the particular line
CalculateMonthDays = wsAbsence.Evaluate("NETWORKDAYS(" & cLng(StartDate) & "," & CLng(EndDate) & ")")
Would anyone know the reason this happens on only 1 machine?
Is there anything I can do to correct the error?
Incidentally, it occurs when the number being input is 0.5 don't know if that makes a difference.
Any help appreciated :dunno