function in query summing results of 2 switch functions?

  • Thread starter Thread starter xz
  • Start date Start date
X

xz

can I build an expression in a query that sums the values of 2
computed fields in the same query.
E.g, Sum(1-CF_1 + CF_2) ? CF_1 & CF_2 are 2 other fields that
use Switch statements.

THanks

Zx
 
slight correction. Can I do this in the Field builder window:

field_B: (CF_1 + CF_2)

if both CF_1 & CF_2 are computed fields in the query themselves
(basically fields computed from switch statements).
Access is giving me an error saying it does not recognize these as "a
valid field name or expression". I'm not sure why - aren't they
expressions :) ?
 
xz,

Try field_B: ([CF_1] + [CF_2])
That is guessing that further to the left in the query,
you have defined CF_1:(your computation) and CF_2: (your computation).
I am not a MVP, so hope they correct me if I am wrong, though I believe the
query works left to right. So if you define a computed field and wish to use
it in another computed field, you have to work your way from the left to
right in the query.
Also I think you may have to have [ ] surrounding the field names/expression
names.

Good Luck,
 
Back
Top