Results 1 to 4 of 4
  1. #1
    samthomasny is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    7

    Count Ifs

    I have a query where I have to summarize the Sales$ and # of orders within a set date range.

    For Sales$ my query works just fine - Sales$: Sum(IIf([tbl_Orders ]![HENTDT]>=[tbl_Campaign]![Begin Date] And ([tbl_Orders ]![HENTDT]<=[tbl_Campaign]![End Date]),[tbl_Orders ]![TOTAL],0))



    I'm trying to replicate the same logic for counting # of Orders by using Count function, but it is not working. Can someone please tell me what it wrong with this query -
    Order Count: Count(IIf([tbl_Orders ]![HENTDT]>=[tbl_Campaign]![Begin Date] And ([tbl_Orders ]![HENTDT]<=[tbl_Campaign]![End Date]),[tbl_Orders ]![ORDER#],0))


  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,641
    I would still use Sum, but use 1 in the True argument instead of a field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    samthomasny is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    7
    I really appreciate the help. That simple solution really worked !!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. count & sum
    By ali zaib in forum Access
    Replies: 1
    Last Post: 01-14-2012, 04:58 PM
  2. Count if (where?)
    By jvlajcic in forum Queries
    Replies: 1
    Last Post: 12-14-2011, 03:09 PM
  3. Count on ID
    By dssrun in forum Access
    Replies: 4
    Last Post: 07-26-2011, 11:45 AM
  4. Sum the Count
    By Adele in forum Queries
    Replies: 5
    Last Post: 07-26-2011, 06:16 AM
  5. Count is off when using =Count
    By boywonder in forum Programming
    Replies: 3
    Last Post: 06-09-2011, 12:14 PM

Tags for this Thread

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