Count but not the repeated ones (1 Viewer)

aattas

Registered User.
Local time
Today, 10:42
Joined
Dec 24, 2014
Messages
69
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, 23:42
Joined
Mar 9, 2014
Messages
3,095
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

CID Moderator
Staff member
Local time
Today, 08:42
Joined
Jan 14, 2017
Messages
13,403
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

error reading drive A:
Local time
Today, 15:42
Joined
May 7, 2009
Messages
9,598
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
Local time
Today, 00:42
Joined
Oct 29, 2018
Messages
10,721
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 (Users: 0, Guests: 1)

Top Bottom