Buckar00B0nzai
Technical User
I currently have a form with a Suspense Date and a Record Entry Date. I am using the following 2 modules to subtract Now() from the Suspense Date in order to keep a timer running on remaining time available.
Module 1
Option Explicit
Function GetElapsedSeconds(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
GetElapsedSeconds = totalseconds
End Function
Module 2
Option Explicit
'------------------------------------------------------------------
' This function calculates the elapsed time between two values and then
' formats the result in four different ways.
'
' The function accepts interval arguments such as the following:
'
' #5/12/95 6:00:00AM# - #5/11/95 10:00:00PM#
'
'
'
' [End Time]-[Start Time]
'------------------------------------------------------------------
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
Here is the problem - once you are late (by even 1 minute), the timer shows "-1 Days" rather than "0 Days".
Any ideas?
Module 1
Option Explicit
Function GetElapsedSeconds(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
GetElapsedSeconds = totalseconds
End Function
Module 2
Option Explicit
'------------------------------------------------------------------
' This function calculates the elapsed time between two values and then
' formats the result in four different ways.
'
' The function accepts interval arguments such as the following:
'
' #5/12/95 6:00:00AM# - #5/11/95 10:00:00PM#
'
'
'
' [End Time]-[Start Time]
'------------------------------------------------------------------
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
Here is the problem - once you are late (by even 1 minute), the timer shows "-1 Days" rather than "0 Days".
Any ideas?