Results 1 to 6 of 6
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Using "Count" function in a report footer

    Is there a form of the count function wherein one can stipulate to not count duplicates? E.g., ControlSource of a text box =Count([LastName]) where it is possible that there are multiple records possible for the same last name. (Only want that name counted once)


    Thanks,
    Bill

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    There is not. You would have to do a query that returns distinct record and do a count on that query in a subreport or do a DCount() expression in textbox on the dataset that has distinct records.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Hummm! I've never had an occasion to use DCount before. I'll go get educated. Can one DCount based on a query?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Yes, domain aggregate functions can refer to queries as data source.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Great! Can one specify "Distinct" in the DCount, or does one need to put that requirement in the query design itself?

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I had to put this (below) in code, as the global variable was inaccessible when coded as the RecordSource for a text box. No big deal, I just set it from code in the On_Report_Footer.

    DCount("lastname", "QOnScholarship", "RetYear = " & """" & [gblRetreatYear] & """")

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

Similar Threads

  1. Column sum works in "Detail" but not "Footer"
    By Doodlebug2000 in forum Reports
    Replies: 1
    Last Post: 12-10-2012, 03:20 PM
  2. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  3. Replies: 2
    Last Post: 11-04-2011, 02:45 AM
  4. Report Footer "Missing Operator" message
    By ewassmer in forum Reports
    Replies: 2
    Last Post: 09-28-2011, 11:03 AM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 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