Connecting Tech Pros Worldwide Forums | Help | Site Map

Data subset in report header

MoreQsThanAs
Guest
 
Posts: n/a
#1: Nov 23 '05
I want to include some summary data in a report section header. In the
example below I want to put in the "Apples" section header the date of the
sale of the last red apple. Everything I try only produces the date of the
last record in that section (10/3/05 instead of 10/2/05, in the example).
Is there a way to effectively enter something into a text field with a
meaning like:

max([SaleDate] where [color]=Red)

EXAMPLE REPORT:
Joe
Apples (Red=2 Green=1 Date of Last Red=10/2/05)
10/3/05 Green
10/2/05 Red
10/1/05 Red



Steve
Guest
 
Posts: n/a
#2: Nov 23 '05

re: Data subset in report header


You can pull the highest date from the table that feeds your report by
adding in an aggregate field to the query you're using. You can use the
MAX() function to take the highest date from your date field and set
the critera to [AppleColorfield]="Red".

Ex: (in the QBE grid)
(Field) LatestRed: MAX([SaleDate])
(Totals) Expression
(Criteria) [color]='Red'

Then every one of your records will have the latest date for red apples
in their LatestRed field. You can bind a textbox to the LatestRed field
in the header of your report.

Another way is to use Domain Aggregate Functions. DLookup, as it were.
This has high overhead, though, so beware.

Closed Thread


Similar Microsoft Access / VBA bytes