Calculate size % of largest size

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

Guest

I have a subform with the following controls:

Cat# (parent)
Item# (child)
Size (numeric field)

The subform is sorted by the size field. Is there a way to calculate the %
of largest size and store it in a control on the subform. Appreciating your
help as usual!
 
I have a subform with the following controls:

Cat# (parent)
Item# (child)
Size (numeric field)

The subform is sorted by the size field. Is there a way to calculate the %
of largest size and store it in a control on the subform. Appreciating your
help as usual!

You can use DMax() to find the largest size. It's best to do so in the
Query upon which the subform is based rather than using an unbound
textbox on the subform; in a vacant Field cell in the query put

PctMax: [Size] / DMax("[Size]", "[tablename]", "[Cat#] = " & [Cat#])

to find the size of each item as a percentage of the largest item for
this particular Cat#. If Cat# is a Text field you'll need some
quotemarks:

"[Cat#] = '" & [Cat#] & "'"

In any case, display this calculated field in a textbox with a Percent
format on the Form.

John W. Vinson[MVP]
 
Back
Top