Minutes

  • Thread starter Thread starter Mick
  • Start date Start date
M

Mick

I have a field on a form that I want to be able to enter
just the hours and minutes. I don't want it to be a time
of day. This field is used to record an amount of time
spent on a project. Any ideas?
 
I have done this as text, then manipulated the text in code to break it apart to use it in
calculations when needed. The other possibility is 2 text boxes, one for hours and one for
minutes. The 2nd option doesn't rely on the user to enter things as perfectly.
 
Just to offer an explanation of why Wayne's solution is the correct one,
Access only recognizes Times as part of a timestamp (i.e.: in conjunction
with a date). This is due to how Access stores date/time values: they're 8
byte floating point numbers, where the integer part represents the date as
the number of days relative to 30 Dec, 1899, and the decimal part represents
the time as a fraction of a day (for example, 6:00 AM will be .25, noon will
be .5, 3:00 AM will be .125, 8:00 AM will be .3333 and so on) If you store
just a time, since the integer part is 0, Access is actually treating the
time as being on 30 Dec, 1899. (It's easy to prove this: simply format your
time as Format(MyTimeValue, "yyyy-mm-dd hh:nn:ss"))

Since they're just numbers, you can add the times together, but as soon as
the sum exceeds 1, you "lose" 24 hours from your total: rather than 6:00 +
8:00 + 6:00 + 7:00 = 27:00, you'll get 3:00 (on 31 Dec, 1899)

HTH
 
Back
Top