Sum date-time fields

  • Thread starter Thread starter Roland
  • Start date Start date
R

Roland

Just starting to use access and this intriges me already:
Is it possible to sum a date/time field in a querie to a number greater then
23:59 ? In excel I use brackets [hh]
And in access ?

Roland
 
Just starting to use access and this intriges me already:
Is it possible to sum a date/time field in a querie to a number greater then
23:59 ? In excel I use brackets [hh]
And in access ?

Roland

Look up the DateAdd() function in VBA help for the various arguments.

To add minutes:
DateAdd("n",[StartTime],[EndTime])

To add Seconds:
DateAdd("s",[StartTime],[EndTime])
 
Thats interesting but my field contains 'worked hours'
And i simply want to run an Totalquerie on that field and the totals may go
up to 100 hours (+minutes)
Access stops at 23:59. There must be a simple work-around I hope
Or should I not use the date-time datatype in this case ?


fredg said:
Just starting to use access and this intriges me already:
Is it possible to sum a date/time field in a querie to a number greater
then
23:59 ? In excel I use brackets [hh]
And in access ?

Roland

Look up the DateAdd() function in VBA help for the various arguments.

To add minutes:
DateAdd("n",[StartTime],[EndTime])

To add Seconds:
DateAdd("s",[StartTime],[EndTime])
 
Roland

In addition to Fred's info about adding, ...

Access does not have a "Time" data type. The Date/Time data type Access
does have stores "point-in-time" data, not duration.

While you can add Date/Time values, the result is a little like averaging
your Gender field.

Good luck

Jeff Boyce
<Access MVP>
 
As noted, you should be storing worked hours as the number of hours, not a
point in time. You can sum your time values to return values greater than 24
hours. Displaying them with a format of a time won't display more than 24
hours. You can use the Int() function against your time total to get the
number of days.

--
Duane Hookom
MS Access MVP


Roland said:
Thats interesting but my field contains 'worked hours'
And i simply want to run an Totalquerie on that field and the totals may
go up to 100 hours (+minutes)
Access stops at 23:59. There must be a simple work-around I hope
Or should I not use the date-time datatype in this case ?


fredg said:
Just starting to use access and this intriges me already:
Is it possible to sum a date/time field in a querie to a number greater
then
23:59 ? In excel I use brackets [hh]
And in access ?

Roland

Look up the DateAdd() function in VBA help for the various arguments.

To add minutes:
DateAdd("n",[StartTime],[EndTime])

To add Seconds:
DateAdd("s",[StartTime],[EndTime])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top