Results 1 to 14 of 14
  1. #1
    Join Date
    Jan 2024
    Posts
    6

    Cool Countifs with unique values in access report


    I am trying to create an expression to give me the count of PO + PO Line but I keep getting the wrong results. See some samples below in red.

    Shipped Orders Query Count

    PO PO Line Expr1
    1 1 2
    2225392 1 1
    2225397 1 1 it should be 2
    2225397 2 1
    2225971 1 1 it should be 3
    2225971 2 1
    2225971 3 1
    3060248 1 1 it should be 3
    3060248 3 1
    3060248 5 1
    3060387 1 1
    3060387 3 1 it should be 2
    3061967 30 1
    3061967 31 1
    3061967 45 1 it should be 3
    3062166 1 1
    3062168 50 1
    3062169 2 1
    3062170 1 1
    3062173 1 1
    3062178 8 1
    3062178 12 1 it should be 2
    3062179 5 1
    3062180 1 1
    3062464 1 1
    3062521 1 1
    3062522 1 1
    3062671 1 1
    3062964 1 1
    3063854 5 1
    3063857 1 1
    3063858 1 1
    3063859 1 1
    3063862 1 1
    3063863 1 1
    3063864 1 1
    3063865 1 1
    3063928 1 1
    3063954 1 1
    3063954 2 1
    3063954 3 1
    3063954 4 1
    3063954 5 1
    3063954 6 1
    3063954 7 1 it should be 7
    3063958 4 1
    3063986 1 1
    3064012 2 1
    3064113 4 1
    3064114 1 1
    3064448 1 1
    3065232 1 1
    3065232 2 1 it should be 2

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Only 1 is red.
    What should 2225971 be?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Join Date
    Jan 2024
    Posts
    6
    Please see the update table sample

  4. #4
    Join Date
    Jan 2024
    Posts
    6
    Thanks, I update the sample table.

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Try SUM() on your 1's?
    However I think you would then get the same value for each PO which is the same?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Join Date
    Jan 2024
    Posts
    6
    It should be 3 - 2225971 - 1, 2225971 - 2, and 2225971 - 3

    2225971 1 1 it should be 3
    2225971 2 1
    2225971 3 1

  8. #8
    Join Date
    Jan 2024
    Posts
    6
    I try Sum() but it give the Sum of the entire table not the sum of each PO

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Set a group in the report on PO.
    Or upload the dB with enough to see the issue. Reports are not my forte, and I have to work on them by trial and error.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Have you designed report with a Grouping section on the PO number? Have you included Count() calculation in group header?
    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.

  11. #11
    Join Date
    Jan 2024
    Posts
    6
    No I did not

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Perhaps you should try. That's how group aggregate calcs are accomplished in report.
    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.

  13. #13
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    In report if you group on PO, then in detail section add an unbound field for your count and on Data tab, for Control Source put 1, then under Running Sum select Over Group (can do Overall if you want it to count all records and then you can reference it at the end for a Grand total, etc.)

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Bulzie, can use RunningSum if there is a need to get a row number for detail records but it is not necessary for group count or even grand total count.
    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: 22
    Last Post: 04-16-2024, 02:23 PM
  2. Count Unique Fields in Access Report
    By alynn1976 in forum Access
    Replies: 1
    Last Post: 05-23-2023, 08:42 AM
  3. Replies: 5
    Last Post: 12-08-2019, 02:01 PM
  4. Replies: 1
    Last Post: 03-17-2017, 04:19 AM
  5. Replies: 3
    Last Post: 01-29-2013, 08:59 AM

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