Re: Converting decimal time into hh:nn:ss time in ACCESS
- From: "Fatma" <fatma_saleh@xxxxxxxxxxx>
- Date: Sun, 17 Dec 2006 13:58:39 +0200
hi,
I'd the same Problem here this code is just fine
get the time1 for the call begins and time2 for its end
then give them to this function it gives me the duration of the call
Put it in a new module then just type =TimeString([fld1];[fld2])
in your report in the ControlSource Property of the field u want the
duration
where fld1,fld2 are the time of call begin and end resp.
-------------------------------------------------------------------------------
Public Function TimeString(time1 As Date, time2 As Date) As String
Dim lHrs As Long
Dim lMinutes As Long
Dim lSeconds As Long
Dim Seconds As Long
Seconds = DateDiff("s", time1, time2)
lSeconds = Seconds
lHrs = Int(lSeconds / 3600)
lMinutes = (Int(lSeconds / 60)) - (lHrs * 60)
lSeconds = Int(lSeconds Mod 60)
Dim sAns As String
If lSeconds = 60 Then
lMinutes = lMinutes + 1
lSeconds = 0
End If
If lMinutes = 60 Then
lMinutes = 0
lHrs = lHrs + 1
End If
sAns = Format(CStr(lHrs), "00") & ":" & _
Format(CStr(lMinutes), "00") & ":" & _
Format(CStr(lSeconds), "00")
TimeString = sAns
End Function
--------------------------------------------------------------
Hope this helps you
Fatma
"M.Garza" <m.garza2006@xxxxxxxxxxxxx> wrote in message
news:1166294528.094350.156150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
This has probably been posted a gazillion times but since I can't
understand VB code just yet (very limited ACCESS knowledge) I haven't
the slightest clue on how to covert a sum of time from decimal to
hh:nn:ss format.
I have created a query based off a table that houses all call center
employee computer (log time) time per day, I've managed to extract
monthly totals for #calls taken, # calls returned to que etc. When I
try to retrieve the minute totals I get a date in ACCESS rather than
the amount of minutes on the phone (00:00:15), I 've worked myself
around this issue by changing the format from 'mmmm yyyy' (this is how
the query brought it over) to 'hh:nn:ss'. After changing the format I
add another field to the query in design view to take the hh:nn:ss
format and turn it into a decimal time, this works great as I delete
the original field and change the (group by) option to sum on the new
decimal field and it gives me the entire month total for each employee.
After all this manipulation, I create a report to bring in all of the
sums for each employee on a monthly basis, all good..... I can
reformat the decimal time to hh:nn:ss with no problem as long as it is
below 24 hours. The problem is that this is a monthly report so the
"log in time, talk time, waiting time" undoubtedly will surpass 24 hrs.
I need to change the decimal time to hh:nn:ss format so the employee
can understand it as they are looking at their "progress" report.
I am not trying to be picky but I would most likely need an explanation
I can enter into the control box of the field (report) rather than go
through Marcos because I am clueless when it comes to CODE, MACROS,
etc.
Currently the report looks like this:
NAME LOGGED WAITING TIME
AVG TALK TIME
Doe, John 143.88 60.96
00:01:05
This is what I want it to look like
10/1/06 - 10/31/06
NAME LOGGED WAITING TIME
AVG TALK TIME
Doe, John 143:52:36 60:57:32
00:01:05 (this is fine since an employee will never have a talk
time of over 24 hrs)
I tried dividing the time by 24 and setting the format but it gives me
09:06:01 for 57:06:01 hrs.
Any help would be greatly appreciated, thanks!
.
- References:
- Converting decimal time into hh:nn:ss time in ACCESS
- From: M.Garza
- Converting decimal time into hh:nn:ss time in ACCESS
- Prev by Date: Re: Listbox selection to table
- Next by Date: Re: Listbox selection to table
- Previous by thread: Re: Converting decimal time into hh:nn:ss time in ACCESS
- Next by thread: Subform Search
- Index(es):
Relevant Pages
|