Calculations in Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to calculate data in Reports? I want to find the difference
between dates/times like a timeclock, then total them up at the bottom of the
page. Right now the data is listed and now I want to start calculating the
data that is listed above each other. Can I do it in a Report?
Any suggestions or feedbacks
 
Brandon said:
Is there a way to calculate data in Reports? I want to find the difference
between dates/times like a timeclock, then total them up at the bottom of the
page. Right now the data is listed and now I want to start calculating the
data that is listed above each other. Can I do it in a Report?


Several ways. The most common is to use an expression in a
text box's control source property. This allows you to use
all the built-in functions as well as any public functions
you create yourself. Most totals are done using the
aggregate functions (Count, Sum, etc), but sometimes a
RunnungSum text box is better.

Another common way is add calculated fields in the report's
record source query.

Most, but not aggregate type, calculations can also be done
using VBA code in a report section's event procedures.

Use the DateDiff function to calculate the difference
between two date/time values. For a timeclock application,
you probably want to use minutes. For example, you could
use a calculated field in the record source query to
determine the number of minutes:
Minutes: DataDiff("n", TimeIn, TimeOut)
the report detail section text box can format that field to
display hours/minutes by using this expression
=Minutes \ 60 & ":" & Format(Minutes Mod 60, "00")

A report (not page) footer section text box can calculate a
grand total:
=Sum(Minutes) \ 60 & ":" & Format(Sum(Minutes) Mod 60, "00")
 
Back
Top