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!

Total Count of Fields on Report

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
I think i've lost my mind. For some reason I can't remember how to do a count of fields on a report. What I have is a list of items. Each item might have more then one object associated with it. What I want to do, is count the total number of ITEMS. What my report is doing is counting an ITEM for EACH object associated with it. In other words, if I have only 5 items but 2 objects each, the report is saying there are 10 ITEMS. How can I do this count on the report? I'm doing a "step" report with footers where each section is broken down by item.

Thanks!

 
Are you using Grouping in your report for the ITEMS? If so, try this:
Code:
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
static ItemCount&
    if FormatCount=1 then
        ItemCount = ItemCount+1
        Me!myItemCount=ItemCount 
    End if
End Sub



Max Hugen
Australia
 
So on my report, instead of saying =count([claimnumber]), I would use DCOUNT? ( = DCount([claimnumber]) )? When I do that, it says wrong number of arguments.
 
You need to look at the syntax in the link I posted:

[tt]=DCount("ClaimNumber","TableOrQuery","OptionalWhere")[/tt]
 
I wouldn't use either code or DCount() on this. There are two solutions that I would find acceptable:
1) use a text box in the Item header section
Name: txtRunSumCount
Control Source: =1
Running Sum: Over All
Visible: No
Then add a text box to your report footer:
Control Source: =txtRunSumCount

2) create a query similar to your report's record source query that groups by something and counts Item. Don't include the table of objects. Then add this totals query to your report's record source query and either join or not depending on the SQL of you queries.


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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top