Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cummulative Time

Status
Not open for further replies.

ohmbru

Technical User
Jul 13, 2001
161
US
Can I format a field in my table to allow a value like 181 hours, 20 minutes, 13 seconds (181:20:13).

I want to import this from an outside source and have limitations on the output format.



Brian
 
Not if you use a datetime field.
You would have to use a text field and create the text string yourself.

Times in Access represent points in time not amounts of time.
 
Create this module in your Database

Code:
Option Compare Database
Option Explicit

Public Function HrsMinsSecs(TimeVar As Double)

Dim Hrs As Long, Mins As String, Secs As String
If IsNull(TimeVar) Then
    HrsMinsSecs = Null
Else
    Mins = Format(DatePart("n", TimeVar), "00")
    Secs = Format(DatePart("s", TimeVar), "00")
    Hrs = (Fix(TimeVar) * 24) + DatePart("h", TimeVar)
    HrsMinsSecs = Hrs & ":" & Mins & ":" & Secs
End If

End Function
and Controle Source of your TextBox that display time will be
Code:
=HrsMinsSecs([FldDateEnd]-[FldDateStart])
[red]Remember your StartTime and EndTime should be Formated
"mm/dd/yy hh:nn:ss" [/red]

Credit of this code goes to the unknown creator.. Not I

Zameer Abdulla

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top