Solved: Start Time End Time Difference in Microsoft Access 2000

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

ka23fabulous

Thread Starter
Joined
Jul 3, 2007
Messages
13
Hi! I have put a "Total Time" field in a form to calculate the difference in minutes from the "Start Time" to the "End Time". I was worried about getting the incorrect time span when the time crossed over midnight. Well, I got that part right, but when I enter times in the same day (1:15pm-1:30pm) it gives me the time difference PLUS 1440 minutes. Please tell me what I need to do to fix this! Thank you!

Total Time:
=DateDiff("n",[Date]-IIf(1-[Start Time]>[End Time],0,1)+[Start Time],[Date]+IIf(1-[Start Time]>[End Time],1,0)+[End Time])
 
Joined
Oct 20, 2004
Messages
7,837
Assuming the dates are sequential, this would work for those over midnight items.
EXPR1: (IIf([End Time]<[Start Time],[End Time]-[Start Time]+24,[End Time]-[Start Time]))

You could also just add a previous date difference expression and use it in the formula in place of the simple "24" - if the difference in days was called [Days apart] then that value would be [Days apart]*24
 

ka23fabulous

Thread Starter
Joined
Jul 3, 2007
Messages
13
Ok, I put in the expression and it is giving me a number of .00138888888889 for a time difference that should be 2 minutes
 
Joined
Nov 5, 2008
Messages
51
Ok, I put in the expression and it is giving me a number of .00138888888889 for a time difference that should be 2 minutes
That's right
Just multiply the result*24*60
The formula would be
EXPR1: (IIf([End Time]<[Start Time],[End Time]-[Start Time]+24,[End Time]-[Start Time]))*1440

the result will be 2.0
SOLVED
 

ka23fabulous

Thread Starter
Joined
Jul 3, 2007
Messages
13
Thank you!! I am working on a database that is a little more involved than ones I usually work on, so I will probably be posting again. Thanks for your help!! :)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top