Results 1 to 6 of 6
  1. #1
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194

    counting amount of GROUPS, not the records in them..

    Hey everyone,



    So i have:


    List of Customers
    List of Items bought (by customers, using CustID)

    I have these all on an invoice PER SHOP.

    Therefore
    SHOP:
    Grouped by customer
    Sorted by item name
    sorted by item quantity


    Now if i use =Count(*) it counts ALL the items sold, eg = 500
    But i want to know how many customers have shopped at that store in this report.
    eg. 50 customers

    SO i really want to... count(CustID), but it still gives me 500!?

    Ideas? Am i looking at this the wrong way??

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Put a textbox in the group header with a control source of

    =1

    and a running sum of Over Group. Call it txtCount. In the report footer, put a textbox with a control source of

    =txtCount
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    thanks pbaldy!

    I finally had time to put aside and try this today

    What i really need though is this data in the header!

    Is there any way to use the =txtcount in the header instead?

  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
    53,633
    I tested. The answer is no. Accomplishing this would require some more elaborate method, not sure what - nested subquery, domain aggregate, subreport, VBA?
    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
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    Thanks June. I ended up creating a subquery which i then use Dcount with and all work well

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Domain aggregate functions can perform slowly in queries. So if you start to notice slowness, this output should be possible with an aggregate query joined to the detail dataset.

    Keep in mind that any filter applied to the report detail dataset must also be applied in the DCount or aggregate query.
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 05-25-2015, 05:02 AM
  2. Replies: 2
    Last Post: 04-02-2014, 09:15 AM
  3. Replies: 2
    Last Post: 06-27-2012, 05:02 PM
  4. Grouping, then counting groups.
    By RedWolf3x in forum Queries
    Replies: 6
    Last Post: 05-31-2012, 09:52 AM
  5. limiting amount of records
    By yaro.kobzar in forum Programming
    Replies: 1
    Last Post: 05-17-2011, 07:01 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