BrokenBiker
ManicMechanic
- Local time
- Yesterday, 18:13
- Joined
- Mar 22, 2006
- Messages
- 128
Hey Y'all,
Well...where should I start? This db report has a few calculations in it, so let me explain them real quick. The db tracks work assessments that are categorized as Pass, Fail, or Non-Rated.
The first is an overall percentage rate of all assessments. Non-Rated assessments are not included in this query. It works fine. In the report it's the Group Total.
The second is a "maintenance" percentage, which is calculated from just two types of assessments. This also works and in included in the report in a sub-report. This is the Maintenance Rate.
Our guidance has recently changed, and I'm trying to incorporate these changes. The first one is an addition to the first/overall percentage. The Group Total is
where Var1 is Pass and Var2 is Fail. This works fine for an overall percentage. However, now we need to deduct 0.5 points for each type inspection "TDV", "UCR", "GO", or "DSV." These are some of the assessment types listed as Non-Rated, however, there are other assessment types listed as Non-Rated that are not part of this criteria.
I included this change in a separate query "qryGroupDeductions." In this query, the 0.5 point per specified-assessment type is calculated by grouping and counting these inspections, then multiplying them by 0.5
This query counts and calculates properly. In the report there's a bit of conditional formatting that's been working so far. I had problems w/ it, but I think it's working properly now.
The problem I'm running into is when you run the queries/reports for a period longer than a month. The instructions on the new guidance don't take into account quarterly or annual reports. When this report is run for periods longer than a month, the 0.5 point deduction makes a disproportional difference because you are deducting a sum from an average. The larger the time-span in the query, the larger the deduction is.
That, my friends, is the problem. I've made one query (qryQtrGrpDeduction) that "solves" this problem. It's based on the "qryGroupDeductions", and uses a basic calculation to create an average for the months.
and
This is very basic, but effective. But using would create a much duplication of queries and reports. I would need one set of reports/sub-report/queries for the month, quarter, and the year. This sample db doesn't show it, but our working database does this same calculation for four different organizational levels....So in using this method, we would need approx 15 queries and reports.
Not cool.
There's gotta be a way to effectively accomplish the requirements w/o creating a multitude of reduncies.
BTY, I'm using Access2003.
-----------------------------------
Key words: calculate, percent, count, report conditional formatting
Well...where should I start? This db report has a few calculations in it, so let me explain them real quick. The db tracks work assessments that are categorized as Pass, Fail, or Non-Rated.
The first is an overall percentage rate of all assessments. Non-Rated assessments are not included in this query. It works fine. In the report it's the Group Total.
The second is a "maintenance" percentage, which is calculated from just two types of assessments. This also works and in included in the report in a sub-report. This is the Maintenance Rate.
Our guidance has recently changed, and I'm trying to incorporate these changes. The first one is an addition to the first/overall percentage. The Group Total is
Code:
Rate: IIf([Var1]+[Var2]=0,"N/A",[Var1]/([Var1]+[Var2]))
where Var1 is Pass and Var2 is Fail. This works fine for an overall percentage. However, now we need to deduct 0.5 points for each type inspection "TDV", "UCR", "GO", or "DSV." These are some of the assessment types listed as Non-Rated, however, there are other assessment types listed as Non-Rated that are not part of this criteria.
I included this change in a separate query "qryGroupDeductions." In this query, the 0.5 point per specified-assessment type is calculated by grouping and counting these inspections, then multiplying them by 0.5
Code:
DeductPoints: [DeductionCount]*0.5
This query counts and calculates properly. In the report there's a bit of conditional formatting that's been working so far. I had problems w/ it, but I think it's working properly now.
Code:
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
If Me.Text64 <= 1 And Me.Text64 >= 0.95 Then
Me.Text66 = "Outstanding"
End If
If Me.Text64 <= 0.9499 And Me.Text64 >= 0.9 Then
Me.Text66 = "Excellent"
End If
If Me.Text64 <= 0.8999 And Me.Text64 >= 0.8 Then
Me.Text66 = "Satisfactory"
End If
If Me.Text64 <= 0.7999 And Me.Text64 >= 0.7 Then
Me.Text66 = "Marginal"
End If
If Me.Text64 <= 0.6999 And Me.Text64 >= 0 Then
Me.Text66 = "Unsatisfactory"
End If
If Me.Text66 = "Outstanding" Then
Me.Text66.FontBold = True
Me.Text66.ForeColor = 8388608
End If
If Me.Text66 = "Excellent" Then
Me.Text66.FontBold = True
Me.Text66.ForeColor = 6723891
End If
If Me.Text66 = "Satisfactory" Then
Me.Text66.FontBold = True
Me.Text66.ForeColor = 0
End If
If Me.Text66 = "Marginal" Then
Me.Text66.FontBold = True
Me.Text66.ForeColor = 65535
End If
If Me.Text66 = "Unsatisfactory" Then
Me.Text66.FontBold = True
Me.Text66.ForeColor = vbRed
End If
End Sub
The problem I'm running into is when you run the queries/reports for a period longer than a month. The instructions on the new guidance don't take into account quarterly or annual reports. When this report is run for periods longer than a month, the 0.5 point deduction makes a disproportional difference because you are deducting a sum from an average. The larger the time-span in the query, the larger the deduction is.
That, my friends, is the problem. I've made one query (qryQtrGrpDeduction) that "solves" this problem. It's based on the "qryGroupDeductions", and uses a basic calculation to create an average for the months.
Code:
QtrAvg: [DeductionCount]/3
and
Code:
DeductPoints: [QtrAvg]*0.5
This is very basic, but effective. But using would create a much duplication of queries and reports. I would need one set of reports/sub-report/queries for the month, quarter, and the year. This sample db doesn't show it, but our working database does this same calculation for four different organizational levels....So in using this method, we would need approx 15 queries and reports.
Not cool.
There's gotta be a way to effectively accomplish the requirements w/o creating a multitude of reduncies.
BTY, I'm using Access2003.
-----------------------------------
Key words: calculate, percent, count, report conditional formatting