J
jason
i created a function to count the number of days to
complete a job, excluding weekends. I tested the function
in the immediate window and it worked properly. When I
put it on the lost focus even of a text box i get a type
mismatch error. i couldn't find anything wrong with the
code so i made a new form and tested the function out with
the same code and it worked properly. so i guess my
question is, what could be causing this type mismatch
error?? here is the code:
thank you in advance for any help you may have.
If Not IsNull(Me.DateIn) And Not IsNull
(Me.DateCompleted) Then
Me.txtDaystoComplete = DaystoComplete(Me.DateIn,
Me.DateCompleted)
Me.txtDaysOutstanding = ""
End If
Public Function DaystoComplete(StartDate As Date, EndDate
As Date) As Integer
Dim intCount As Integer
intCount = 0
Do While StartDate <= EndDate
If Weekday(StartDate) <> vbSunday And Weekday
(StartDate) <> vbSaturday Then
intCount = intCount + 1
End If
StartDate = StartDate + 1
Loop
DaystoComplete = intCount
End Function
complete a job, excluding weekends. I tested the function
in the immediate window and it worked properly. When I
put it on the lost focus even of a text box i get a type
mismatch error. i couldn't find anything wrong with the
code so i made a new form and tested the function out with
the same code and it worked properly. so i guess my
question is, what could be causing this type mismatch
error?? here is the code:
thank you in advance for any help you may have.
If Not IsNull(Me.DateIn) And Not IsNull
(Me.DateCompleted) Then
Me.txtDaystoComplete = DaystoComplete(Me.DateIn,
Me.DateCompleted)
Me.txtDaysOutstanding = ""
End If
Public Function DaystoComplete(StartDate As Date, EndDate
As Date) As Integer
Dim intCount As Integer
intCount = 0
Do While StartDate <= EndDate
If Weekday(StartDate) <> vbSunday And Weekday
(StartDate) <> vbSaturday Then
intCount = intCount + 1
End If
StartDate = StartDate + 1
Loop
DaystoComplete = intCount
End Function