Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calculating time in an Access report

Posted on 2008-10-23
3
Medium Priority
?
247 Views
Last Modified: 2013-11-28
I have a table in my database that I wish to report on.  The data is organized as follows:

EventDate - DATE field
EventResult - TEXT field

There are 8 possible results, and the table looks something like this....

EventDate              Result
10/23/08 12:01        RED
10/23/08 12:02        BLU
10/23/08 12:02        RED
10/23/08 12:03        RED
10/23/08 12:04        GRN
10/23/08 12:05        RED
10/23/08 12:06        YEL
10/23/08 12:08        BLU
10/23/08 12:09        GRN
10/24/08 12:01        RED
10/24/08 12:02        RED
10/24/08 12:03        BLU
10/24/08 12:03        RED
10/24/08 12:07        YEL
10/24/08 12:08        RED

What I want to do is sub-total (count) the records and also determine the amount of time passed.  

EX:

10/23/08
RED-4
BLU-2
YEL-1
GRN-1
TOTAL-8
8 minutes
AVG 1 per minute

10/24/08
RED-4
BLU-1
YEL-1
GRN-0
TOTAL-6
7 minutes
AVG .85 per minute

I have worked out most of the problem with counting the 'subtotals' in the report by using a DCOUNT funtion in the group footer (thanks to help in another post!) but I have no idea how to attack the calculation of time passed from the first event to the last event for each day.  It's simple math ...  DATE2-DATE1=TIME ELAPSED, but how to I capture what the value for the first event of each day, the last event of each day, and calculate the difference between them by group?


0
Comment
Question by:callstate
  • 2
3 Comments
 
LVL 2

Expert Comment

by:armynt4
ID: 22789979
Try using the min and max aggregate function in your report's query.

so max(Time1)-min(Time2)=time elapsed

I'll try it as well to see what i get.
0
 
LVL 6

Expert Comment

by:carazuul
ID: 22789997
Hi callstate,
DMAX - DMIN over the same criteria should work.
Regards,
carazuul
0
 
LVL 2

Accepted Solution

by:
armynt4 earned 2000 total points
ID: 22790543
So on the report you may need to play with the Result field sum calculation.  
But if you list all the time values in the detail of the report you can add a field in the date's group footer with a value like......


DateDiff('n',Min([Time]),Max([Time]))


[Time] being the name of the time value field in your table/query
Creating this Time field by .... Time: Format([EventDate],'hh:mm')

Should work.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question