How do I sort by calculated field

  • Thread starter Thread starter PAR
  • Start date Start date
P

PAR

relationship = one buyer to many purchases. Report is summary of buyer
purchases. Number of purchases and total purchased. The number of purchases
is calculated "=Count([Lot Info]![Lot No])" , the total purchase is
calculated "=Sum([Price])"

How can I make the report sort by descending total purchases? By descending
total lots?

To get the information to report one total line sorting and grouping is set
to group by buyer number, group ascending. group on each value, interval =1,
keep together = whole group.
 
Presumably the sum of price is in a group footer, so Access calculates it as
it goes. If so, you cannot sort by this expression, since it doens't have
all the value until it has finished laying out the report, which is too
late.

To sort by a total, you need to get that total into the report's Record
Source. One way to do that is to use a Totals query, i.e. depress the Total
button in query design. This feeds the total to the report, so you can sort
by the total, but you don't get the detail records that way. Perhaps you
could use a subreport to show all the details for each total.
 
Back
Top