Results 1 to 4 of 4
  1. #1
    donnysl is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    2

    Problem with IIF function

    I am trying to develop a query called "ro2" based on the values of two fields: R SO2 R, R SO2 L

    The query returns an error saying "You tried to execute a query that does not include the specified expression 'ro2: IIf([R S02 L] Is Null,[R S02 R],Avg([R S02 L]+[R S02 R]))' as part of an aggregate function"

    The query i am trying to use is below. it should say that: if "R SO2 L" is missing, use "R SO2 R", if not, use the average of the two values.



    ro2: IIf([R S02 L] Is Null,[R S02 R],Avg([R S02 L]+[R S02 R]))

    Any help would be great.

    Thank you,
    Donny

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Just a guess, but you might try:

    ro2: IIf(IsNull([R S02 L]),[R S02 R],Avg([R S02 L]+[R S02 R]))
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Why use Average.

    There are only two values.

    Suggest (([R S02 L]+[R S02 R]) /2)

  4. #4
    donnysl is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    2
    Bob,

    it says that there is an "Extra ) in query expression"

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

Similar Threads

  1. Problem with function?
    By devxweb in forum Access
    Replies: 2
    Last Post: 01-07-2013, 08:43 AM
  2. Concatenate function problem
    By Matt18 in forum Programming
    Replies: 1
    Last Post: 11-19-2011, 05:37 AM
  3. Problem with IIF function
    By Hulk in forum Forms
    Replies: 3
    Last Post: 03-20-2011, 12:59 PM
  4. VBA Function problem
    By smikkelsen in forum Programming
    Replies: 5
    Last Post: 07-16-2010, 07:46 AM

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