Help Please!

  • Thread starter Thread starter Floyd forbes
  • Start date Start date
F

Floyd forbes

I have a report with a column that is base on time . I tried
to sum the column e.g. 8:33,00:33,1:23,5:50 and about another one hundred
times, but the total came out wrong. Is it possible to calculate one column
and get a correct time of hours and minutes.

Forbes
 
Floyd forbes said:
I have a report with a column that is base on time . I tried
to sum the column e.g. 8:33,00:33,1:23,5:50 and about another one
hundred times, but the total came out wrong. Is it possible to
calculate one column and get a correct time of hours and minutes.

A report, or a form? This is the .forms newsgroup, after all.

If your column is a date/time field, then it's meant to hold
point-in-time information, not durations. An Access date/time field is
stored as double-precision floating-point number representing the number
of days and fractions of days since (or before) a specfic "zero"
instant, which is midnight, December 30, 1899. If totalling your
date/time field yields more than 24 hours, it's going to be confusing,
because either you apply a time-only format and thus don't see the date
portion of the value, or you do see the date portion of the value and
suddenly realize you're looking at a date, not a number of hour and
minutes.

There are two ways to approach this problem. Probably the best is not
to use a date/time field to store durations. Instead, store them as a
number field -- long integer, if that will be big enough -- representing
a simple count of minutes (or seconds, if you need that level of
resolution). Then convert this count to hours and minutes for display
purposes. If you want, you can also have an in-conversion function to
take a user entry in the form "hh:mm" in an unbound text box and convert
it to a simple count of minutes. The coding for this is quite simple.

If you don't want to change your date/time fields to simple duration
fields, then you can compute your total as a date/time field and then
convert it to hours and minutes by converting it to a Double,
multiplying it by 1440 (the number of minutes in a day) and then
computing the number of hours and minutes in that result.
 
What kind of field is this? There is no format in Access that I know of
that can be used for duration which comes out in hours and minutes.

I would expect your column to contain 8.56, 0.56, 1.39, 5.85, etc.

You can't sum times, only durations. Durations are not in a time format.

Rick


I have a report with a column that is base on time . I tried
to sum the column e.g. 8:33,00:33,1:23,5:50 and about another one hundred
times, but the total came out wrong. Is it possible to calculate one column
and get a correct time of hours and minutes.

Forbes
 
Back
Top