calculations within queries

K

Kathryn

I am attempting a rather complicated query to produce many different
calculated values based on each other, most of them work but two of the
calculations are asking for values when I run the query as if they were
parameterized which they are not.

The first is: fields A and B and the field C:Nz([A],0)/(,0) and then
when I run the query it asks me what C is. This is a problem since I use C in
other calculated fields later on and it is supposed to be pulling from the
database.
 
V

Van T. Dinh

C is an alias and you cannot use it in calculations in the Query.

You need to repeat the same expression instead of C in your "later"
calculations.

Actually, we don't know which one is the earlier calculation and which one
is the later calculation in JET. We think of calculate C first and then use
C in later calculations. However, JET may not "think" the same way. Hence,
you cannot use the alias C.
 
G

George Nicholson

In addition to Rick and Van's response:
Nz([A],0) / (,0)

What is [A] being divided by?? Did you omit a 2nd Nz?:
Nz([A],0) / Nz(,0)
and even then, what about division-by-zero errors if is 0 or Null?

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Kathryn said:
I am attempting a rather complicated query to produce many different
calculated values based on each other, most of them work but two of the
calculations are asking for values when I run the query as if they were
parameterized which they are not.

The first is: fields A and B and the field C:Nz([A],0)/(,0) and then
when I run the query it asks me what C is. This is a problem since I use C
in
other calculated fields later on and it is supposed to be pulling from the
database.
 
Top