Count but not the repeated ones (1 Viewer)

aattas

Registered User.
Local time
Today, 08:46
Joined
Dec 24, 2014
Messages
74
Experts,
I think this is a very simple question but nothing works for me.

How can i tell the report not to count repeated numbers?

I did declare to hide the duplicates and still it is counting.

I tried to defined a specific field =str(Count(ref)) but still it is counting as if it is still there.

Thanks
 

June7

AWF VIP
Local time
Yesterday, 21:46
Joined
Mar 9, 2014
Messages
5,399
Build a query that aggregates data so values are not duplicated and use that as report recordsource. Provide sample of data or attach database.
 

isladogs

MVP / VIP
Local time
Today, 05:46
Joined
Jan 14, 2017
Messages
18,164
Hiding the duplicates just stops them being displayed but they are still there.
As June said, create your report using a query with no dupes e.g. Try SELECT DISTINCT
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:46
Joined
May 7, 2009
Messages
19,094
this will work on Print Preview only:
Code:
Dim dict As Object
dim lngCount As Long

Private Sub Report_Open(Cancel As Integer)
    Set dict = CreateObject("scripting.dictionary")
End Sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If dict.Exists([[I]TextboxNameToCount[/I]] & "") = False Then
        lngCount = lngCount + 1
        dict.Add [[I]TextboxNameToCount[/I]] & "", [[I]TextboxNameToCount[/I]]
    End If
    Me.[I]TextboxToDisplayCount[/I] = lngCount
End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:46
Joined
Oct 29, 2018
Messages
21,322
Hi. You might also be able to use Grouping in your report to do the counting. Just a thought...
 

Users who are viewing this thread

Top Bottom