Excluding Criteria in Count

  • Thread starter Thread starter Sol
  • Start date Start date
S

Sol

I would like to count the records in a subform, excluding
records that have either of (2) different criteria in a
field. I would also like it to include records that have
a null value in that same field in the count.

I have created a text box on the the subform footer, and
will eventually put in on the main form, but can't get the
expression to count the field types I need it to.

I have used =Sum(Abs() and Dcount(), but can't get it
right. DCount could work, perhaps, except I can't get it
to accept the subform as the domain. The subform is made
up of fields from joined tables, and maybe I'm not using
the right string. If I use the source of the field it
gives me the total of records on the main form.

I appreciate the help
 
Sol,

Using DCount(), you will need to refer to the subform's underlying
query as the domain of the function.

The "direct route" you have been trying should possibly be something
like this:
=Abs(Sum([YourField] Is Null Or [YourField] Not In(1stCrit,2ndCrit)))

- Steve Schapel, Microsoft Access MVP
 
Back
Top