Subtract time

  • Thread starter Thread starter Janet
  • Start date Start date
J

Janet

I have 2 fields: start time and stop time. I would like
to have a calculated text box that displays the
difference between the start and stop times. I tried: =
[StopTime]-[StartTime], but that doesn't work.

Thanks!
 
Thank you!

Janet
-----Original Message-----
Janet,

Look at the DateDiff function in the Help file.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


I have 2 fields: start time and stop time. I would like
to have a calculated text box that displays the
difference between the start and stop times. I tried: =
[StopTime]-[StartTime], but that doesn't work.

Thanks!


.
 
I found this example in another online forum. If your
times span more than one day (ex: StartTime=23:55 and
StopTime=00:15). I've had to use this example in two
different apps and it works like a charm.

([StopTime]-[StartTime]+IIf([StopTime]<[StartTime],1,0))
*24

Diana Criscione
 
I found this example in another online forum. If your
times span more than one day (ex: StartTime=23:55 and
StopTime=00:15). I've had to use this example in two
different apps and it works like a charm.

([StopTime]-[StartTime]+IIf([StopTime]<[StartTime],1,0))
*24

Diana Criscione
-----Original Message-----
I have 2 fields: start time and stop time. I would like
to have a calculated text box that displays the
difference between the start and stop times. I tried: =
[StopTime]-[StartTime], but that doesn't work.

A Date/Time value (regardless of format) is stored as a Double Float
number, a count of days and fractions of a day (times) since midnight,
December 30, 1899. As such it doesn't work very well for storing
durations - it's actually best to store just points in time.

The DateDiff() function will return the time between two date/time
values (and if you store the date with the time, it will span one or
multiple midnights with ease). To get the calculated time in miNutes
use

DateDiff("n", [StartTime], [StopTime])

"m" is Months, "n" is miNutes, "h" is hours, etc. - see the online
help in the VBA editor.
 
Back
Top