Solved

Query filter

Posted on 2014-11-13
2
173 Views
Last Modified: 2014-11-13
Experts:

I haven't used Access for a while so I'm a bit "rusty" on query filters.

Please find attached 2 documents:
1. QueryCalculation.mdb
2. Calculation.xls

The database contains one Table and two queries.    The spreadsheet mimics the value set in Table1.

In the two Access queries, I'm trying to calculate the average values for the four records BUT MUST EXCLUDE any records where value = 999.

The difference between query 1 and query 2 is where I placed the filter "< > 999" ("and" vs. "or").

The XLS provides the correct average values.   That is, I've manually excluded the 999 values in the average calculation.

My question:   How I can get same four average values (as shown in XLS) in an MS-Access query?

Thanks,
EEH
QueryCalculation.accdb
Calculation.xlsx
0
Comment
Question by:ExpExchHelp
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40441055
try this query


SELECT Avg(IIf([Field1]=999,Null,[Field1])) AS Expr1, Avg(IIf([Field2]=999,Null,[Field2])) AS Expr2, Avg(IIf([Field3]=999,Null,[Field3])) AS Expr3, Avg(IIf([Field4]=999,Null,[Field4])) AS Expr4
FROM Table1;
0
 

Author Closing Comment

by:ExpExchHelp
ID: 40441804
Perfect solution!!  Thank you!
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question