Results 1 to 4 of 4
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    error when trying to do a calculation in query


    All; I don't do a lot of calculations in my queries but this one calls for it. But I'm getting an error: your query does not include the specified expression. In my query I want to perform a calcuation:

    Code:
    Taxes: ([AvgEE]+([AvgEE]*(1+[TO])/2*[base]))
    I get the above error but when I put a SUM or AVg in front of it:
    Code:
    TaxableWgs: Avg([AvgEE]+([AvgEE]*(1+[TurnoverRate])/2*[wage_base]))
    This works but with the wrong results from my manual calculation. Even if I break it down I still get the error. What am I doing wrong?

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Are you doing this in an Aggregate (Totals) Query?
    You need to do an Aggregate Query if you want to do an Average or Sum, as you need to tell the query which fields you are grouping by.

    See:
    http://www.fontstuff.com/access/acctut04.htm
    https://www.techonthenet.com/access/...umeric/avg.php

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    not sure if relevant, but your first example uses TO, the second TurnoverRate

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    your query does not include the specified expression.
    This usually means that the referenced fields are either
    a) misspelled or
    b) not in the query.

    Does the query have fields (columns): "AvgEE", "TO", "base" (or "TurnoverRate", "wage_base")??

    Maybe post the SQL of the query??

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

Similar Threads

  1. Replies: 3
    Last Post: 08-13-2016, 05:58 AM
  2. #Name? Error coming after field calculation
    By aparnawangu in forum Forms
    Replies: 1
    Last Post: 11-23-2015, 05:04 AM
  3. Replies: 1
    Last Post: 02-26-2014, 12:53 AM
  4. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  5. Calculation error
    By wasim_sono in forum Forms
    Replies: 1
    Last Post: 03-26-2009, 02: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