Kenny said:
I have a table in which there are 17 ([S1]-[S17]) fields that are Yes, No,
NA and NS as responses. At the end of these fields I have a text box that
requires a total of yes responses.
What do I need to enter in the SYes box to get a Count of Yes Values?
This kind of unnormalized table is always going to cause you
trouble like this. A database's xomputational capabilities
are geared toward working with rows, not columns. To be
effective in creating databases, you should stop thinking in
a spreadsheet paradigm and start looking at data with
relational colored glasses ;-)
First, a table should not have related columns (i.e. it
rarely makes sense to add multiple columns together).
Second, you can not use an expression in a table field. In
fact you should not even store a calculated value in a table
field. Calculations should be done in a query (or a
form/report).
You can calculate what you want in a query using a caculated
field:
SYes: -(S1="Yes") - (S2="Yes") - . . .
The reason for the minus signs is that Access uses -1 for
True. But, if any of those Sx field could be Null, then
you'll have to wrap each term with the Nz function:
. . . - Nz((S2="Yes"), 0) - . . .
If you had normalized your data by placing the Sx data in a
single column in a separate table (with an appropriate
foreign key), this whole issue would be solved by joining
the two tables and simply using:
SYes: -Sum(S = "Yes)