Display number of groups in Report Header (Access 2000)?

J

Jimmy B

Ok, so apparently this isn't possible from what I've read.

I used this little trick and can display the total in the Report Footer, but
I want the result in the Header!
http://www.mvps.org/access/reports/rpt0016.htm

Why is this simple thing so difficult? Does anyone know how to do this?
I'd be happy if I could just refer the text box in the Report Footer from a
text box in the Report Header. This would at least give me what I need.
There HAS to be a way to do it.

Please help! Thanks!
 
D

Duane Hookom

Create a totals query similar to your report's record source but group by
your group header field and don't include any additional detail. Save the
query with the name "qgrpMyGroup". Then, add a text box in the report header
with a control source of:
=DCount("*","qgrpMyGroup")
 
J

Jimmy B

Ok, I did find a way by using OnFormat Event code in the Report Footer. Is
this the only way to do it? Does anyone know?
 
J

Jimmy B

Yeah, I guess I have thought of that. I suppose you can do anything with
external queries. I wanted to do it without resorting to external queries,
but I failed to mention that. Did they ever add a way to allow this Access
XP or 2003 without trickery? I haven't gotten to play with those much yet.

I figured out how to do it within the same report using the OnFormat Event
code in the Report Footer. Not the most elegant, but it does work.

I can't even believe Microsoft ever made Access work this way.


Thank you for the reply!
 
F

fredg

Ok, so apparently this isn't possible from what I've read.

I used this little trick and can display the total in the Report Footer, but
I want the result in the Header!
http://www.mvps.org/access/reports/rpt0016.htm

Why is this simple thing so difficult? Does anyone know how to do this?
I'd be happy if I could just refer the text box in the Report Footer from a
text box in the Report Header. This would at least give me what I need.
There HAS to be a way to do it.

Please help! Thanks!

Because the report Header prints well before the Report Footer, you
cannot directly get a value from the footer and place it in the
header.

However, if you add a control to the report to compute [Pages] (you
may already have one, i.e. =[Page] & " of " & [Pages]), you can add an
unbound control to the report header. Leave it unbound.

Then code the Report Footer Format event:
Me!ControlNameInHeader = Me!ControlNameInFooter

When you run the report, Access formats the report twice, once to
compute the total number of pages, at which time the report footer
contains the number of groups, and then a second time when the report
is actually displayed or printed.
Now the total is available for the header.

Hope this helps.
 
Top