Data Vaildation

  • Thread starter Thread starter Cameron Hicks
  • Start date Start date
C

Cameron Hicks

Hi,

What i am trying to do is have a text field display '00:00' and when the
user enters 5 the field changes to 00:05, meaning 5 minutes. If i use the
time data type it changes to 12:05. I don't want a clock but a duration of
time spent in minutes and hours. So the field can eventually be totalled.

I have been playing with format and input mask without any success. So if
you could help that would be great.

Ta
Cam
 
The Date/Time field is really designed to store dates and times rather than
duration. You may find it better to use a Long Integer field to store a
value in minutes. This makes the data entry so much easier, solves the
problems inherent in trying to display sums of date/times that exceed 24
hours, and is much easier and more efficient for calculations.

For data entry purposes, you can use a pair of unbound text boxes where the
user enters the hours and minutes, e.g.:
[ ]:[ ]
and use the AfterUpdate event procedure of both boxes to write the value to
the hidden field.

For display purposes, you can use:
=[Minutes] \ 60 & Format([Minutes] Mod 60, "\:00")
 
Hi,

What i am trying to do is have a text field display '00:00' and when the
user enters 5 the field changes to 00:05, meaning 5 minutes. If i use the
time data type it changes to 12:05. I don't want a clock but a duration of
time spent in minutes and hours. So the field can eventually be totalled.

Date/time fields aren't really appropriate for durations. A Date/Time
field is stored internally as a Double Float count of days and
fractions of a day since midnight, December 30, 1899 - so storing
"five minutes" actually stores the moment of time five minutes after
midnight on that date.

You may want to store a Long Integer count of minutes, and use an
expression like

[Duration] \ 60 & Format([Duration] MOD 60, ":00")

to display in hh:nn format.
 
Back
Top