Solved

Difference between two times

Posted on 2013-11-29
2
368 Views
Last Modified: 2013-11-29
Hi,

I am using DateDiff in Access 2010 to show the time difference between 2 times.

Minutes: DateDiff("n",[ClockInTime],[ClockOutTime])

The above works fine, unless ClockOut time is after midnight, in which case I get a negative and inaccurate result.

Can anyone tell me how I need to modify this simple query so that when I run it I get the correct results.

Thanks
0
Comment
Question by:LJShepherd
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
Hi,

pls try (supposing it cannot be more than 24 hours)

Minutes: DateDiff("n",[ClockInTime],IIf([ClockOutTime]<[ClockInTime],[ClockOutTime]+1,[ClockOutTime]))

Open in new window


Regards
0
 

Author Closing Comment

by:LJShepherd
Comment Utility
Brilliant, works perfectly thank you!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now