Calculating Averages In my Report

geraldcor

Registered User.
Local time
Today, 22:40
Joined
Jan 26, 2004
Messages
145
I have a report where one of the things it displays is the time it took person "A" and the time it took person "B" to complete a sample and the difference between the two. If the person forgets to write the time it took them to finish the sample the person entering the data will either put in a 1 or 0 or leave it blank. I need to have an average time difference for one person compared to all the people that did the other half of the sample. Currently This is what I have.
If IsNull(Me.A1stTime) Or IsNull(Me.B1stTime) _
Or Me.A1stTime = 0 Or Me.B1stTime = 0 _
Or Me.A1stTime = 1 Or Me.B1stTime = 1 Then
'Don't Count Them
Else
TmeCnt = TmeCnt + 1
End If

If IsNull(Me.A1stTime) Or IsNull(Me.B1stTime) _
Or Me.A1stTime = 0 Or Me.B1stTime = 0 _
Or Me.A1stTime = 1 Or Me.B1stTime = 1 Then
Me.TimeDifference = 0
Else
Me.TimeDifference = Me.Report1stTime - Me.CompareTo1stTime
End If
This is in the detail format event. I have Dim TmeCnt As Long
and the text box for the calculations in my report is Me.Timecounter=TmeCnt.
The numbers I get are completely wrong. I do the averages by hand and thy are close but just not right. Also when I print It divides my average by two (Which is closer to the real average but not perfect) One evaluation was correct the rest were not.
I am sorry for the long confusing post but this has been eating at me for days and I can't quite fix this.
Thank you for any help and suggestions. I need to get this working within the next couple of days for my boss.
 
geraldcor,

If you can't put the logic into a query because the records show
not be filtered out, then you have the right approach.

However, the Detail Format can fire multiple times for a given
record. Once to see that "it does not fit" on a page and then
again (on the next page) where it will fit.

Use the Detail Print event AND set a breakpoint so that you
can check the intermediate results.

Wayne
 
This makes sense but I still have the problem when the values fit on one page. I am also not sure how to set a good break point to see what I'm doing. I put my code in the Detail_Print event and it does the some thing.
 

Users who are viewing this thread

Back
Top Bottom