Results 1 to 5 of 5
  1. #1
    mphynson44 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    7

    DAvg with multiple criteria help

    Hi I am having and issue with DAvg involving multiple criteria. I am using the expression below and it returns the average of everything, I just want it to average the criteria below. Any help would be greatly appreciated.

    Round(DAvg("turnaround","Ad Closed","[request reason]='Existing Client'" And "[request reason]='ANNUAL REVIEW'" And "[request reason]='THREE YEAR REVIEW'" And "[request reason]='UPDATE REVIEW'"),1)

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Your parameters are literal text so the WHERE CONDITION argument should be one long criteria string. You have too many quote marks. Include the AND operators within the string and have quote marks at only begin and end of the entire criteria string.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mphynson44 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    7
    Quote Originally Posted by June7 View Post
    Your parameters are literal text so the WHERE CONDITION argument should be one long criteria string. You have too many quote marks. Include the AND operators within the string and have quote marks at only begin and end of the entire criteria string.
    Makes sense, that helped a little bit but when I run it now I only get the average for the first criteria Existing Client. See below for what I ran this time.

    Existing Client Turnaround: Round(DAvg("turnaround","Ad Closed","[request reason]='Existing Client' And 'ANNUAL REVIEW' And 'THREE YEAR REVIEW' And 'UPDATE REVIEW'"),1)

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You have to repeat the field name for each parameter. Wait, AND won't work, try OR instead.

    Go back to your original structure, remove the extra quote marks, replace AND with OR.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    mphynson44 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    7
    Quote Originally Posted by June7 View Post
    You have to repeat the field name for each parameter. Wait, AND won't work, try OR instead.

    Go back to your original structure, remove the extra quote marks, replace AND with OR.
    Worked like a charm, Thank you for the help!

    just for anyone who find this on future searches this is it:

    Round(DAvg("turnaround","Ad Closed","[request reason]='Existing Client' OR [request reason]='ANNUAL REVIEW' OR [request reason]='THREE YEAR REVIEW' OR [request reason]='UPDATE REVIEW'"),1)

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

Similar Threads

  1. Replies: 2
    Last Post: 04-10-2013, 03:54 PM
  2. Replies: 7
    Last Post: 01-02-2013, 11:23 PM
  3. Problem with DAvg function
    By averagejoe in forum Access
    Replies: 1
    Last Post: 10-05-2012, 05:43 AM
  4. If Then Else Multiple Criteria
    By GrayWolf in forum Programming
    Replies: 5
    Last Post: 04-12-2012, 07:27 PM
  5. Replies: 1
    Last Post: 07-13-2011, 11:00 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