A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Time Calculation



 
 
Thread Tools Display Modes
  #1  
Old November 21st, 2006, 01:57 PM posted to microsoft.public.access.queries
Scott
external usenet poster
 
Posts: 1,119
Default Time Calculation

I am calculating the amount of time that an employee is tardy. I am using
the following expression: TardyTime:
Format([ATIME]/1440)-([SHSTART]/1440),”h:nn”). The problem I have is that if
an employee punches in early the expression doesn’t return a negative amount
of time. How do I get the expression to return a negative amount of time for
punches prior to the scheduled start time and a positive amount of time for
punches after the scheduled start time? I’ve also tried an IIf statement,
TardyTime:
Format(IIf(([SHSTART]/1440)([ATIME]/1440),([SHSTART]/1440)-([ATIME]/1440)*-1,([SHSTART]/1440)-([ATIME]/1440)),"h:nn").

Thanks for your help.

  #2  
Old November 21st, 2006, 03:24 PM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Time Calculation

See:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html

The article explains how (and why) to get the result in minutes, and then
display it as hours and minutes.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Scott" wrote in message
...
I am calculating the amount of time that an employee is tardy. I am using
the following expression: TardyTime:
Format([ATIME]/1440)-([SHSTART]/1440),"h:nn"). The problem I have is that
if
an employee punches in early the expression doesn't return a negative
amount
of time. How do I get the expression to return a negative amount of time
for
punches prior to the scheduled start time and a positive amount of time
for
punches after the scheduled start time? I've also tried an IIf statement,
TardyTime:
Format(IIf(([SHSTART]/1440)([ATIME]/1440),([SHSTART]/1440)-([ATIME]/1440)*-1,([SHSTART]/1440)-([ATIME]/1440)),"h:nn").

Thanks for your help.



  #3  
Old November 21st, 2006, 04:46 PM posted to microsoft.public.access.queries
Scott
external usenet poster
 
Posts: 1,119
Default Time Calculation

Worked great, thanks!

"Allen Browne" wrote:

See:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html

The article explains how (and why) to get the result in minutes, and then
display it as hours and minutes.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Scott" wrote in message
...
I am calculating the amount of time that an employee is tardy. I am using
the following expression: TardyTime:
Format([ATIME]/1440)-([SHSTART]/1440),"h:nn"). The problem I have is that
if
an employee punches in early the expression doesn't return a negative
amount
of time. How do I get the expression to return a negative amount of time
for
punches prior to the scheduled start time and a positive amount of time
for
punches after the scheduled start time? I've also tried an IIf statement,
TardyTime:
Format(IIf(([SHSTART]/1440)([ATIME]/1440),([SHSTART]/1440)-([ATIME]/1440)*-1,([SHSTART]/1440)-([ATIME]/1440)),"h:nn").

Thanks for your help.




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.