Add results from fields in a form

  • Thread starter Thread starter smeldawg
  • Start date Start date
S

smeldawg

I have a form that contains 18 fields from one table. They all containd drop
downs allowing the user to select yes, no or n/a. How can i count the number
of yes in these 18 fields in a separate field?
 
Are these 18 different fields in one row, or 1 field in 18 different rows?

For the former (which, by the way, makes me question the validity of the
data model), you can add a computed field in a query that sums together the
18 fields. True is stored as -1, while False is stored as 0. That means that
Abs(Nz([Field1], 0) + Nz([Field2], 0) + Nz([Field3], 0) + ... +
Nz([Field18], 0)) will be the number of True values in the row.

For the latter, you can use DCount("*", "MyTable", "MyField = True"), or a
Totals query.
 
Back
Top