How to use custom format [h]:mm like in excel

J

jinks

How can I show a form in pivochart view summing the hours that passed between
two dates?

where is the excelent custom format [h]:mm???
 
K

Klatuu

In Access, you have to do it yourself. First you need to use the DateDiff
function to get the number of minutes.

lngHrsAndMins = DateDiff("n",StartTime, EndTime)

Then you have to separate the hours and minutes.

strShowTime = Format(lngHrsAndMins \ 60, "00\:") & Format(lngHrsAndMins Mod
60, "00")

the \ divisor returns on the integer part and gives you the number of hours.
the Mod operator returns only the remainder part and gives you the number of
minutes.
 
J

jinks

When I do that I can obtain in a query the difference in hours between two
dates, but I can't show it in a pivotchart, because I can't sum the
"showtime", because is a string.

Klatuu said:
In Access, you have to do it yourself. First you need to use the DateDiff
function to get the number of minutes.

lngHrsAndMins = DateDiff("n",StartTime, EndTime)

Then you have to separate the hours and minutes.

strShowTime = Format(lngHrsAndMins \ 60, "00\:") & Format(lngHrsAndMins Mod
60, "00")

the \ divisor returns on the integer part and gives you the number of hours.
the Mod operator returns only the remainder part and gives you the number of
minutes.
--
Dave Hargis, Microsoft Access MVP


jinks said:
How can I show a form in pivochart view summing the hours that passed between
two dates?

where is the excelent custom format [h]:mm???
 
K

Klatuu

then just leave it as a number and don't format it.
--
Dave Hargis, Microsoft Access MVP


jinks said:
When I do that I can obtain in a query the difference in hours between two
dates, but I can't show it in a pivotchart, because I can't sum the
"showtime", because is a string.

Klatuu said:
In Access, you have to do it yourself. First you need to use the DateDiff
function to get the number of minutes.

lngHrsAndMins = DateDiff("n",StartTime, EndTime)

Then you have to separate the hours and minutes.

strShowTime = Format(lngHrsAndMins \ 60, "00\:") & Format(lngHrsAndMins Mod
60, "00")

the \ divisor returns on the integer part and gives you the number of hours.
the Mod operator returns only the remainder part and gives you the number of
minutes.
--
Dave Hargis, Microsoft Access MVP


jinks said:
How can I show a form in pivochart view summing the hours that passed between
two dates?

where is the excelent custom format [h]:mm???
 
Top