Hi John, I put this in the text box control source: =DateDiff("n",
[Time In],[Time Out]), which works fine for each record time in and
time out. Then, in the text box in my footer to sum all of those
minutes, I have tried: =Sum(DateDiff("hh:nn",[Time In],[Time Out])),
and other things, but cannot get a sum yet. I need to sum it for hours
and minutes, but can't find the proper code to cause that to happen on
my report. Hope you can guide me in the right direction. Thanks, David
Press Ctrl-G to open the VBA editor, and search Help for information on
DateDiff. "h" is a valid argument, "n" is a valid argument - but "hh:nn" is
not!
I would suggest a different approach. Put a calculated field in the Queryupon
which the report is based, rather than in a textbox on the report; the
calculated field would be
Duration: DateDiff("n", [Time In], [Time Out])
to put a number (a long integer) of minutes as a field in the query. You can
sum number fields in a query on a report; you cannot (effectively) sum
date/time values, as you have found, and you certainly cannot sum text
strings.
In the report's detail section you can just bind a textbox to Duration tosee
the (integer) minutes, e.g. 489 for 8 hours 9 minutes; or you can use an
expression
=[Duration] \ 60 & Format([Duration] MOD 60, "\:00")
to display it as 8:09. Similarly, in the Name footer you can use
=Sum([Duration]) \ 60 & Format(Sum([Duration]) MOD 60, "\:00")
to add up the minutes and display the sum in hh:nn format.
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Fo...al.answers.microsoft.com/Forums/en-US/addbuz/
and see alsohttp://
www.utteraccess.com