Results 1 to 8 of 8
  1. #1
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63

    Count fields


    I have a report souced from a criteria query. The user must enter the order date and all orders occuring on/after that day will appear in the report. What I would like to have included at the top of the report are counts for 1) how many orders there are 2) how man orders have been shipped and 3) how many orders have been backordered. This number will change each time the report is run to reflect the records that match the critieria. Is there any way that I can accomplish this? I'm not sure if I need code or a query. I've attached the db for analysis. Thanks.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Try the following expressions as textbox ControlSource

    =Sum(IIf([Status]=1,1,0))

    =Sum(IIf([Status]=2,1,0))
    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
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63
    Thank you! These work great. I was struggling with DCount functions. Is there any way to count how many orders total appear in the report and possibly provide percentages for the shipped/backordered fields? I.E. based on the criteria there were 10 orders- 5 shipped, 2 backordered. Shipped % = 50% and Backordered % = 20%

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    You already have the total order count with the expression: =Count("*")

    Now in other textboxes have expression that divides the Shipped by Count and BO by Count:
    =tbxShipped/tbxCount
    =tbxBO/tbxCount

    Can set the Format property to Percent or in the expressions: * 100
    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
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63
    Thanks. There's so much info I could pull from this report. I tried inserting a =count(isnull(OSID)) to count all the orders that doing have any shipping info but it gives back the same result as Count("*").

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Try:

    =Sum(IIf(IsNull(OSID),1,0))
    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.

  7. #7
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63
    THANKS!! That did the trick. Just for curosity, why didn't =Count(isnull(OSID)) work?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    The IsNull() function will return a value of True or False and the Count will count all returns, regardless of what it is except for Null. Null is ignored by aggregate functions. Try: Count(IIf(IsNull([OSID]),1,Null))
    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. not count date fields if the same
    By Icky_Joe in forum Queries
    Replies: 2
    Last Post: 04-11-2012, 12:55 PM
  2. Multiple count of query fields
    By BLD21 in forum Queries
    Replies: 2
    Last Post: 05-23-2011, 01:09 PM
  3. Count and Sum of unbound fields?
    By C90RanMan in forum Forms
    Replies: 0
    Last Post: 07-29-2010, 01:17 PM
  4. two fields needing to look like one for a count how?
    By techexpressinc in forum Queries
    Replies: 2
    Last Post: 05-29-2009, 01:06 PM
  5. Count numerical and alphabetic fields
    By nukethrower in forum Queries
    Replies: 0
    Last Post: 02-26-2008, 10:51 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