Re: How to summarize recordset...Select Distinct alternative?



MP wrote:
Thanks Bob,
sorry bout that...

vb6
ado / adox 2.8
(writing to .mdb format)
(not using access, just jet)

<Report:>
File/Page Summary:
File1
Page1
Item1 Count(3)
Item2 Count(2)
Item3 Count(1)

Totals Summary:
Item1 TotalCount(12)
Item2 TotalCount(4)
Item3 TotalCount(3)
Item4 TotalCount(4)
<End Report>


Your options are limited with Jet. Shaped recordsets may be the answer,
but I've never used them and can only advise you to look them up in the
documentation.

This could be done with a single recordset, but I think I would go with
two recordsets:
1. Select FldFile,FldPage,FldItem,Count(*) As ItemCount
FROM ...
GROUP BY FldFile,FldPage,FldItem

You can loop through this one to using Filter to easily do the first
section of your report. You could increment some variables (or array
elements) during the loop to get the values for the Totals, or you could
close this recordset and open a second on the following sql:

2. Select FldItem,Count(*) As ItemCount
FROM ...
GROUP BY FldItem
You can loop through this one for your totals section



--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


.



Relevant Pages

  • Re: subreport/report total question
    ... it gives me the exact same totals as ... the job footer should do). ... In the subreport, move your DayTotal text box into the Report Footer ... Page Header ...
    (microsoft.public.access.reports)
  • Re: subreport/report total question
    ... In the subreport, move your DayTotal text box into the Report Footer section, so it collects all values in the subreport. ... job totals always match the Work_Date totals because it gives me a job total ... > I have a Report with two subreports put in the detail section of the> main ...
    (microsoft.public.access.reports)
  • Re: Summing time
    ... You can't use the HoursAndMinutesfunction since it returns a string. ... For March I need my report to show ... All of my fields are displaying totals in this format ...
    (microsoft.public.access.reports)
  • Re: Page totals error in report - doesnt add correctly
    ... display it on a form or report. ... query based on the Import Table. ... All Totals text boxes properties are set to General number with 2 decimal ...
    (microsoft.public.access.reports)
  • Re: subreport/report total question
    ... In the subreport, move your DayTotal text box into the Report Footer ... Page Header ... job totals always match the Work_Date totals because it gives me a job ...
    (microsoft.public.access.reports)