Results 1 to 6 of 6
  1. #1
    JennyL is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    51

    Count Records (only count duplicate record once)

    Hi,



    I have been searching all day on how to count duplicate record once but no luck. I have a form with list of records but sometimes same customer id is used. I want to have a unbound txtbox to show

    - number of Active Status with L90 field counted once
    - number of Closed status with L90 fields counted once


    I tried to do it through query but don't know how to tell the query to count only once for L90 field.

    any recommendation on how I can do this easily?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    make a query to pull your data needed, and set the query property UNIQUE VALUES = TRUE.
    this will eliminate duplicates.

    Then make a query on THAT query to count.

  3. #3
    JennyL is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    51
    I did but still didn't work. I must be missing something. Could you provide details on how to do it? I went to Property sheet and change the Unique Values to YES.

    Quote Originally Posted by ranman256 View Post
    make a query to pull your data needed, and set the query property UNIQUE VALUES = TRUE.
    this will eliminate duplicates.

    Then make a query on THAT query to count.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    you only want fields in the query that will produce a unique record.
    you cant add say fields in the query that have nothing to do with what you want
    if you want to count persons who attended:
    name, date.

    having the date field will produce duplicate names (even tho they are diffenent dates)
    so the Q1 would only have
    NAME
    (but date would be in the criteria, but not shown)
    now you have unique names.

  5. #5
    JennyL is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    51
    I am not sure if I follow your description above.

    what I have is

    ID
    Status
    AccountNumber
    L90
    L20

    L90 information could be repeated in some records.

    I want the query to show number of L90's in Active Status (only counting L90 once), if that makes sense.

    I tried changing the unique record but still same result.

    Thanks,

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Query 1 - All L90's with Active Status:
    SELECT DISTINCT Table1.L90 FROM Table1 WHERE (((Table1.Status)="Active"));

    Query 2 - count the number of records in Query 1
    SELECT Count(Query1.L90) AS CountOfL90 FROM Query1;

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 02-08-2017, 05:52 PM
  2. Replies: 23
    Last Post: 01-27-2016, 01:42 PM
  3. count Duplicate
    By JustinC in forum Access
    Replies: 3
    Last Post: 08-18-2014, 09:24 AM
  4. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 PM
  5. Query to count errors when records duplicate
    By mkallover in forum Queries
    Replies: 1
    Last Post: 07-15-2011, 11:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums