Expressions for Aggregates in Reports

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

Guest

What is the best method to display in a report the minimum for a field
[square foot] that has various criteria attached [middle income] [low income]
[high income]? I wish to have a min and max square footage for each of these
categories in my report which is grouped by completely different means (state
and home name).

JL
 
Try this:

Add unbound text boxes for the min and max values (in report footer?). In
the report header's Format event procedure initialise them to zero, e.g.

txtMinFootageLowIcome = 0
txtMaxFootageLowIncome = 0

In the detail section's Format event procedure assign values conditionally
to each control:

If txtMinFootageLowIncome = 0 Then
txtMinFootageLowIncome = [square foot]
Else
If txtMinFootageLowIncome < [square foot] Then
txtMinFootageLowIncome = [square foot]
Else
End If

If txtMaxFootageLowIncome = 0 Then
txtMaxFootageLowIncome = [square foot]
Else
If txtMaxFootageLowIncome > [square foot] Then
txtMaxFootageLowIncome = [square foot]
Else
End If

Do similarly for other income groups.
 
I wish you would have stated how the income levels are recorded... Assuming
you have a field named [IncomeLevel] with values of "M", "L", and "H".
Create a totals query by your "different means" and income level. Select one
column as the Min([Square Feet]) and one as the Max([Square Feet]). Use this
total query as the record source of a subreport placed in your main report.
 
I missed a couple of lines. To make each min/max value conditional on the
income level you ned to wrap each block of f code in an If statement, e.g.
for low income levels, if this wewre to be indicated by a value in a text
field IncomeLevel:

If [IncomeLevel] = "Low"
If txtMinFootageLowIncome = 0 Then
txtMinFootageLowIncome = [square foot]
Else
If txtMinFootageLowIncome < [square foot] Then
txtMinFootageLowIncome = [square foot]
Else
End If

If txtMaxFootageLowIncome = 0 Then
txtMaxFootageLowIncome = [square foot]
Else
If txtMaxFootageLowIncome > [square foot] Then
txtMaxFootageLowIncome = [square foot]
Else
End If
End If
 
Back
Top