Solved

Calculating time in an Access report

Posted on 2008-10-23
3
235 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 500 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now