Results 1 to 5 of 5
  1. #1
    spyldbrat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    73

    Aggregate Function Expression Error

    I am getting "YOUR QUERY DOES NOT INCLUDE THE SPECIFIED EXPRESSION 'CUSTOMER' AS PART OF AN AGGREGATE FUNCTION. After doing some research, I found I need to somehow group some or all of these columns but when I do so, I don't get the details listed for each customer. I also know the problem somehow lies with the formula. PLEASE HELP!

    SELECT Aging.[Customer], Aging.[Cust ID], Aging.[PO #], Aging.[Inv #], Aging.[Ship To/Store #], Aging.[Days Aging], Aging.[Inv Amt], Aging.[Bal Due], Email_Address.[Email Address], IIf(Max([days Aging]) Between 0 And 34,"",IIf(Max([days Aging]) Between 35 And 45,"Your a deadbeat",IIf(Max([Days Aging]) Between 46 And 60,"Loser","Pay Me"))) AS Expr1


    FROM Aging INNER JOIN Email_Address ON Aging.[Cust ID] = Email_Address.[Cust ID];

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Did you make this a Totals query (sigma character on ribbon)?

    You might find this easier to solve by using a query to populate a temp table with the calculations, minimum number of fields related to the calculation where at least one of them is related to the main table or query and is indexed. Then join that table to a 2nd query to get the remainder. A totals query sometimes cannot be grouped while still returning the desired records.

    BTW - by temp table I do not mean one that you continually recreate.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    spyldbrat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    73
    I am not sure what you are trying to tell me (my Access skills are very basic). I tried doing the two things below (thinking maybe this was what you were telling me I should try):

  4. #4
    spyldbrat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    73
    I just rebuilt the entire query and joined the table. It seems to be working now.

    Thank you.

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    referring to character at far right of image
    Click image for larger version. 

Name:	Sigma.jpg 
Views:	8 
Size:	9.6 KB 
ID:	38539

    Then there is always my friend Google who has 618,000 things to say when I asked him "ms access totals query".
    Clicking that may not be the entire solution for your problem but it is a prerequisite.
    You might want to post a zipped db copy if you get to struggling with this a lot. How to:

    https://www.accessforums.net/showthread.php?t=70301

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

Similar Threads

  1. Aggregate in expression error
    By rhet256 in forum Access
    Replies: 3
    Last Post: 07-11-2018, 08:40 AM
  2. Replies: 1
    Last Post: 06-14-2015, 09:48 AM
  3. Replies: 5
    Last Post: 11-19-2012, 01:44 PM
  4. aggregate error due to function
    By boutwater in forum Access
    Replies: 2
    Last Post: 09-26-2011, 03:39 PM
  5. an aggregate function error message
    By newtoAccess in forum Queries
    Replies: 1
    Last Post: 11-27-2010, 05:18 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