Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Totals don't match group details

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
US
I have a report that is supposed to count the number of records based off a query and show the details. If the total number of records is 5 then I need 5 records showing in the body of the report. Sometimes this works and sometimes it's one record off. The report has 2 groups: 1st one is just for sorting by assigned date and doesn't have any headers. The 2nd one is by project name and shows the info. In the report header I have a text box with the control source saying

<b ="Total Submittals: " & Count([fldDateAssigned])/b>

Is there a better way to do the count?
 
From Access help for the count function...

The Count function does not count records that have Null fields unless expr is the asterisk (*) wildcard character

Try the following instead.

Code:
 ="Total Submittals: " & Count(*)

FYI sum also ignores nulls. I'm not too sure off the top of my head about the other aggregate functions.
 
Thanks. I ended up trying the add a text box to the project group header with
name: txtcountproj
control source = 1
running sum = all over
visible = no
AND added a txt box to report FOOTER that had
control Source = txtcountproj

This counted perfectly BUT I need the count to be in the report HEADER not the FOOTER. Any Ideas?
 
There is at least one possible solution in another thread where you asked the same question.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Lhuffst came in with a different specification from the first posting. It seems Lhuffst wants the report to count groups rather than records.

Count(*) is the best method for counting records, while other solutions are required to count unique groups.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
dhookom,

Looking closer at his solution I see that he is counting the sections...

I was focused on the original question, running sum and...

This counted perfectly BUT I need the count to be in the report HEADER not the FOOTER.


Silly me [ponder] [smile]

So what is this other thread? I'm curious at this point.
 
Another post had something similar (really the same) but they wanted the value to show in the footer where I need it to show in the Report header. Here is a sample

Project1
1/2/07 this is note 1 with a bunch of other fields
Project2
1/3/07 this is note 1
1/4/07 this is note 2
Project3
1/3/07 this is note 1
So I have 4 detail lines within 3 groups. I am trying to count the number of groups and put it in the header.

If I do count(*), it gives me a 4

 
Dhookom's answer in thread703-1386902 should work.

Although it might also work to have the control in the rerport footer and put a control in the report header set equal to it. That is worth a shot but Dhookom's answer will definitely work.
 
Thanks Everyone for your suggestions. What I ended up doing is the suggestion from dhookom with an added twist.
I created a text box in projectID header section
Name: txtcountproj
control source = 1
Running Sum = Over All
Visible = no

I Created a text box in report footer that said
Name: txtCntProjFooter
control source = txtCountProj

I created a text box in Page Header
Name: fincnt


On the ReportFooter On Format
fincnt=txtCntProjFooter
Works great. Thanks again for all the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top