control in access report

  • Thread starter Thread starter LP
  • Start date Start date
L

LP

Is it possible to use the division operator in control source?
For example, using
=DCount("[Field1]","qryX","[Field1]=True")+DCount("[Field2]",qryX","[Field2]=True")......+DCount("[Field6]","qryX","[Field6]=True")
and then I want to divide the number, in the same control, by the number of
fields (6 in the example) to obtain the average.
regards
 
Yes. You can use / as a divisor, e.g.:
=(DCount(...)+ ...) / 6

Since True is -1 and False is zero, you could also sum the fields to get the
negative count of the Yeses. This might be a more efficient approach, e.g.:
=Abs(DSum("[Field1]+[Field1]+[Field3]", "qryX")) / 3

In general, lots of yes/no fields that you want to sum like that probably
indicates that you don't have a relational data structure. More info:
Don't use Yes/No fields to store preferences
at:
http://allenbrowne.com/casu-23.html
 
Back
Top