Results 1 to 3 of 3
  1. #1
    bishmedia is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    44

    Using the =sum & where criteria

    Hi Everyone

    Firstly I'm new to SQL but we all have to start somewhere, here's my question...



    I have a textbox in a report which in the 'controsource' i have placed =Sum([Quantity])
    which sums the whole 'Quantity' column great but what if I only want specific customers to sum using the WHERE criteria??


    =sum([Quantity]) WHERE ([Customer]) = "Woolworths"

    Whats the correct way of doing something like the above??

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    not tried this but suggest

    =sum(iif([Customer]="Woolworths",[Quantity],0))

  3. #3
    bishmedia is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    44
    Spot on, I was going about it all wrong...

    Many Thanks :-)

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

Similar Threads

  1. Replies: 1
    Last Post: 08-15-2016, 05:56 AM
  2. Replies: 2
    Last Post: 04-02-2015, 12:45 PM
  3. Replies: 1
    Last Post: 11-13-2014, 11:34 PM
  4. Replies: 4
    Last Post: 08-30-2014, 10:23 AM
  5. Replies: 5
    Last Post: 08-02-2012, 09:44 AM

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