Selasa, 20 Maret 2012

[MS_AccessPros] Invalid Use of Null error

 

I found this function for calculating elaspe time but when I move to a new record I recieve a "Invalid Use of Null". I think I understanding th cause but I am not sure how to fix it. Please advise.

Here is the code:

Function GetElapsedTime(interval)

Dim totalhours As Long, totalminutes As Long, totalseconds As _
Long
Dim days As Long, hours As Long, Minutes As Long, Seconds As Long

days = Int(CSng(interval))
totalhours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
totalseconds = Int(CSng(interval * 86400))
hours = totalhours Mod 24
Minutes = totalminutes Mod 60
Seconds = totalseconds Mod 60

GetElapsedTime = days & " Days " & hours & " Hours " & Minutes & _
" Minutes " & Seconds & " Seconds "

End Function

Private Sub Form_Load()

If Not Me.NewRecord Then
Me.txtElaspedTime = GetElapsedTime([EndTime] - [StartTime])
Else
Me.txtElaspedTime = ""

End If

End Sub

Private Sub Form_Current()

If Not Me.NewRecord Then
Me.txtElaspedTime = GetElapsedTime([EndTime] - [StartTime])
Else
Me.txtElaspedTime = ""

End If
End Sub

Thank you,

Arthur Lorenzini
Siooux Falls, SD

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar