Criteria Expression for Query (Count)

M

MooreFaith

OK, so I thought I had this right, but I guess I don't.

I have a Warranty Database with a table called Marketing. In this
table, I have fields for HomeAge and HomeOccupied. If the homeowner
doesn't respond to these questions on the warranty, the default is 0
(for no response). In any case, the field is always a number.

I am trying to run several queries for this particular field. In the
first query, I want to count the number of records that are 0 for no
response. In all the other queries, I want to count the number of
records that fall between two numbers (a range of years). For example,
47 people own homes that are between 31 and 40 years old.

I had this set up in Design View as:
Fieldname: HomeAge
Table: Marketing
Total: Count
Criteria: "HomeAge"="0" (will not run if "HomeAge"=0) for the
non-responders, or
Criteria: "HomeAge" Between 1 And 10

I can understand if the second criteria is incorrect, but I don't
understand why the first always turns up just 0, because I know there a
several non-responders for this field.

Sorry for the long message - please help me!

Amanda
 
R

Rolls

You are summarizing data in an existing table. Do this with a query. Step
through the query design going from simple to complex. The first thing I
would try is a select query with the test criteria applied to see if you can
select just those valid records being tested. If you want to count records
= 0 then the select query should return only those records. Once that's
right, add a Where clause and add a field to Count.

Next in your criteria take out 0 and replace with "Between 1 and 10", which
should return all records in that range, completing the stratification.

The icon for grouping is a Sigma sign. Learn to use it in combination with
the Sum, Count, Where, Max, etc., selections in the QBE window.

Activating the sigma icon (group) is NOT the same as "Sum". A sigma sign in
Excel means "sum" but that is not what it means in Access.

To understand what these choices do, look at the Design-SQL View to see them
in code as yoy make changes to the QBE test query.

The "Find Duplicates" query is a simple query with a test field selected.
The criteria is ">1" and the Count selection is also made in the query,
which returns a list of records for which there exists more than one in the
table. It's a close cousin of what you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top