RE: Need help with a query



thanks for the reply, but i don't know how to write the criteria to set the
count to ZERO if a yes appears in the column.

come to think of it i don't think that you can use an if statement in a
Query in Access 2003.

Item 1 No
Item 2 No
Item 1 No
Item 3 No
Item 2 Yes
Item 2 No
Item 4 Yes
Item 1 No
Item 3 No

A count statement for above would read

Item 1 3
Item 2 2
Item 3 2
Item 4 1

I would like to reset the count to 0 (ZERO) when a yes is found, which would
return

Item 1 3
Item 2 1
Item 3 2
Item 4 0

Is this possible for a query.
P.S. SQL would be easier.


Al....




"Deborah Jean" wrote:

In the Query design window type both criteria on the AND row. In other word
on the same line even if you have to include the field twice.

"Sproul" wrote:

I've been using Access 2003 for about a year now but would still consider
myself a new user.
I'm having a problem trying to create a query, if indeed the query is
possible to create.

I want to be able to create a count for individual item i.e. there could be
15 instances if one item 10 of another and so on, however i only want it to
count the instance if a certain field = NO, (here comes the hard part) if the
filed with no is YES i want it to reset the count for that item to ZERO.

the database has and incremantal ID field for each record and also a
Timestamp field which i've renamed TSinfo for obvious reasons.


Can anyone give me a few pointers?


Al....
.



Relevant Pages

  • Re: Populating null field in queries
    ... So, in the grid of the Query Design view, in one of the "cells" in the ... If it doesn't like you using an existing name, change "SumOfphtcnt" ... Here is the expression I used in the criteria for the field I want null ... values return as zero where before some had actual numbers. ...
    (microsoft.public.access.queries)
  • Re: Query Info
    ... I've never had that problem with the grid. ... >> zero, then you simply place that criteria in the 4 fields in the query grid. ... >> Of course the query is looking for records where ALL 4 fields satisfy the criteria. ...
    (microsoft.public.access.formscoding)
  • Re: Conditional printing of records in the detail section of a rep
    ... I got sick, still sick, so I'm putting this on hold for the moment. ... In query design, type an expression like ... sums the numbers from approximately 35 numerical fields ... The default data is zero. ...
    (microsoft.public.access.reports)
  • Re: how to format date to have a specific format
    ... Hello John. ... So in my query I have a column that does this: ... But when I put 04-10-2007 in criteria the access removes the zero I runs the ...
    (microsoft.public.access.queries)
  • Re: Conditional printing of records in the detail section of a rep
    ... The query option, as outlined in your post, doesn't work. ... The default data is zero. ... commands used in the Event Procedure? ... unbound form with a command button to open the report filtered, ...
    (microsoft.public.access.reports)