Could you look at this function and tell me why I am getting an
exception concerning date cast on line set apart by stars... If you have
better suggestions of how to do this I would be open to suggestions.
Public Function JobStreamCheck() As Boolean
Dim hour As Integer
Dim day As Integer
Dim year As Integer
Dim month As Integer
Dim ActionTime As DateTime 'time action is occuring that we are
checking to make sure no jobstream is running. Time obtained from SQL
using GetDate 'formatted as say for example 4:15 PM . Start and End
Times are also gotten from SQL but for this example they are declared
locally
Dim JobStreamStart As DateTime
Dim jobstreamend As DateTime
month = Format(ActionTime, "MM")
hour = Format(ActionTime, "HH")
day = Format(ActionTime, "dd")
year = Format(ActionTime, "yyyy")
JobStreamStart = Format(JobStreamStart, month & "/" & day & "/"
& year & " hh:mm tt")
If Format(JobStreamEnd, "HH:mm tt") > Format("23:59 PM", "HH:mm
tt") Then
JobStreamEnd = (JobStreamEnd, month & "/" & day + 1 & "/" &
year & " HH:mm tt")) 'move day ahead one because job stream will be in
new day
Else
'********EXCEPTION THROWN
jobstreamend = Format(jobstreamend, month & "/" & day & "/"
& year & " HH:mm tt") 'job stream will finish in same day
'*******EXCEPTION THROWN END
End If
If ActionTime >= JobStreamStart And ActionTime < jobstreamend
Then
Return True ' Job stream is running dont allow login
Else
Return False ' job stream is not running so allow login
End If
End Function