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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Time Calc



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2007, 12:08 AM posted to microsoft.public.access.reports
DS
external usenet poster
 
Posts: 285
Default Time Calc

I have this formula to get Elapsed Time...it works fine except I have an
additional problem. My Date and Time are two seperate fields for reasons to
deep to go into. Should I or can I combine the two fields LogDateIn &
LogTimeIn to make this work or is there another way.

=DateDiff("n",[LogTimeIn],[LogTimeOut])

The fields are...

LogDateIn
LogTimeIn
LogDateOut
LogTimeOut

Thanks
DS


  #2  
Old May 11th, 2007, 01:00 AM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 2,364
Default Time Calc

You should be able to add the two together

LogDateIn + LogTImeIn to get a value that is the date and time together.

The only problem will be if one of the two is Null (blank) then you will
get a null value for the calculated combination.

So the following should be perfectly valid and return the number of
minutes between LogIn and LogOut.


=DateDiff("n", LogdateIn + logTimeIN,LogDateOut + LogTimeOut)

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


DS wrote:
I have this formula to get Elapsed Time...it works fine except I have an
additional problem. My Date and Time are two seperate fields for reasons to
deep to go into. Should I or can I combine the two fields LogDateIn &
LogTimeIn to make this work or is there another way.

=DateDiff("n",[LogTimeIn],[LogTimeOut])

The fields are...

LogDateIn
LogTimeIn
LogDateOut
LogTimeOut

Thanks
DS


  #3  
Old May 11th, 2007, 02:57 AM posted to microsoft.public.access.reports
DS
external usenet poster
 
Posts: 285
Default Time Calc

Thanks John, I see what you mean about the Null. Any Suggestions.
Thanks
DS
"John Spencer" wrote in message
...
You should be able to add the two together

LogDateIn + LogTImeIn to get a value that is the date and time together.

The only problem will be if one of the two is Null (blank) then you will
get a null value for the calculated combination.

So the following should be perfectly valid and return the number of
minutes between LogIn and LogOut.


=DateDiff("n", LogdateIn + logTimeIN,LogDateOut + LogTimeOut)

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


DS wrote:
I have this formula to get Elapsed Time...it works fine except I have an
additional problem. My Date and Time are two seperate fields for reasons
to deep to go into. Should I or can I combine the two fields LogDateIn &
LogTimeIn to make this work or is there another way.

=DateDiff("n",[LogTimeIn],[LogTimeOut])

The fields are...

LogDateIn
LogTimeIn
LogDateOut
LogTimeOut

Thanks
DS



  #4  
Old May 11th, 2007, 03:20 AM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 2,364
Default Time Calc

It is easy to handle this for the time fields

Nz(LogTimeIn,0) will return midnight

Handling null dates depends on what you want to do. You can use Nz to
return the zero date - December 10, 1899 or you can return some other date.

=DateDiff("n",Nz(LogDateIn,LogDateOout) + Nz(LogTimeIn,0),
Nz(LogDateOut,LogDateIn) + Nz(LogTimeOut,0))


That will give you a numeric result as long as LogDateIn or LogDateOut
has a value other than null. It may not give you a desired result.

You have to decide what rule(s) you want to apply to handle null values.

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


DS wrote:
Thanks John, I see what you mean about the Null. Any Suggestions.
Thanks
DS
"John Spencer" wrote in message
...
You should be able to add the two together

LogDateIn + LogTImeIn to get a value that is the date and time together.

The only problem will be if one of the two is Null (blank) then you will
get a null value for the calculated combination.

So the following should be perfectly valid and return the number of
minutes between LogIn and LogOut.


=DateDiff("n", LogdateIn + logTimeIN,LogDateOut + LogTimeOut)

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


DS wrote:
I have this formula to get Elapsed Time...it works fine except I have an
additional problem. My Date and Time are two seperate fields for reasons
to deep to go into. Should I or can I combine the two fields LogDateIn &
LogTimeIn to make this work or is there another way.

=DateDiff("n",[LogTimeIn],[LogTimeOut])

The fields are...

LogDateIn
LogTimeIn
LogDateOut
LogTimeOut

Thanks
DS



 




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 09:53 AM.


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