Connecting Tech Pros Worldwide Help | Site Map

Problem on a report..,?

christian
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi everyone!

I've been trying to add some Date/time fields in a report:

I've a Text Box on the report footer that says:

Worked**=Sum([WorkedHours])

The Problem is that when an Employee works more than 24:00 hours, the
value goes back to 00:00. for Instance when someone works 23:59 it
calculates fine, but if the person works more than 24:00 hours, the
value goes 00:00.

Is there anyway that I can fix this??

Thanks in Advanced.
Rick Brandt
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Problem on a report..,?


"christian" <csepulveda@partners.org> wrote in message
news:e1cc3cc3.0407120543.4e8f8369@posting.google.c om...[color=blue]
> Hi everyone!
>
> I've been trying to add some Date/time fields in a report:
>
> I've a Text Box on the report footer that says:
>
> Worked**=Sum([WorkedHours])
>
> The Problem is that when an Employee works more than 24:00 hours, the
> value goes back to 00:00. for Instance when someone works 23:59 it
> calculates fine, but if the person works more than 24:00 hours, the
> value goes 00:00.
>
> Is there anyway that I can fix this??[/color]

Access DateTime fields are for storing "points in time", not "amounts of
time". It might be your intention that an entry of 12:15 means 12 hours
and 15 minutes, but to Access it represents 12:15 PM on December 30, 1899.
When you add 12 hours to it you end up at 15 minutes past midnight on
December 31, 1899.

The best way to deal with this is to store a DateTime as a starting point,
another as an ending point, and then use DateDiff to calculate the
difference in whatever is the lowest increment you care about (say minutes
for example). Then your report can sum the minutes which can easily be
converted back to hours and minutes for display.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



cristian sepulveda
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Problem on a report..,?



Thank you so much for your response, but I dont'understand how to store
a DateTime as a starting point and ending point and how to use the
DateDiff??

can you give me an example..

Thanks

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Rick Brandt
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Problem on a report..,?


"cristian sepulveda" <csepulveda@partners.org> wrote in message
news:40f29d1d$0$16443$c397aba@news.newsgroups.ws.. .[color=blue]
>
> Thank you so much for your response, but I dont'understand how to store
> a DateTime as a starting point and ending point and how to use the
> DateDiff??
>
> can you give me an example..[/color]

Well, where is your [WorkedHours] coming from now? Are users just entering
7:30 in a DateTime field to indicate 7 1/2 hours worked? If so you could
just use a number field and enter 7.5 instead. You could also have unbound
controls where the user enters the hours worked in a time format and then
use code to convert that to a decimal number value which would actually be
stored in your tables.

Another way to go would be to enter the Date/Time they clocked on and the
Date/Time they clocked off into separate fields and then use...

DateDiff("n", [ClockOnTime], [ClockOffTime]) to get the total number of
minutes between those two events. The number of minutes could then be
summed and the total displayed after converting back to a Time format.

TotalHours = Sum(Minutes)\60 & ":" & Format(Sum(Minutes) Mod 60, "00")

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



Closed Thread