Solved

Count unique records in detail section of report

Posted on 2015-02-02
1
169 Views
Last Modified: 2015-02-02
I've tried various queries to resolve this issue but so far no luck.  So I want to try a new approach.

I have a report that has a grouping.  In the group is a detail section that has a field named POn.  Also in the detail section of a field named POnCount.  I don't know if the VBA code I'm looking for is in the onprint or onformat event of the detail section but every time a new POn is found, increment the POnCount by 1.  If the POn was already cycled through then don't increment by 1.

The after the group has printed set the POnCOunt over at 0.

How can this be done?
0
Comment
Question by:SteveL13
1 Comment
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40584050
If the report is sorted by POnCount, then add a grouping footer and let Access do the work for you.  No code required.  You don't even have to have a visible control in the footer.  Add a control, make it very small so the footer won't take up a lot of room.  Name it CountPO.  Set its ControlSource to:
=1
Set the Grouping property to OverAll.  Add a control to the report footer to display the value.
=CountPO

If not, then you will need to create a separate query that does the counting.  You can add a subreport to the report footer to display a recap that gives you the counts you want.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now