Solved

Count unique records in detail section of report

Posted on 2015-02-02
1
171 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 36

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

828 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