calculating multiple fields in an unbound text box

D

Dummie

I have a report based on a query that links 2 tables by the field "Type".
Each tiype in the one table has a minimum price. The other table has the type
and actual sales prices in four different fields of which only one is used in
the calculations. I am calculating the difference between actual selling
price and minimum price.

the problem I am having is that although the minimum price is always
desplayed for the type, the calculation does not work for the different
fields. If the first field is null, then the next 3 fields should be checked.
The other fields may or may not be null because of muliple items sold at the
same time. I only need to calculate these other fields if they are the only
ones with a value.

Could I do this in code? If so, how do I have the code run when this field
is calculated.
 
M

Marshall Barton

Dummie said:
I have a report based on a query that links 2 tables by the field "Type".
Each tiype in the one table has a minimum price. The other table has the type
and actual sales prices in four different fields of which only one is used in
the calculations. I am calculating the difference between actual selling
price and minimum price.

the problem I am having is that although the minimum price is always
desplayed for the type, the calculation does not work for the different
fields. If the first field is null, then the next 3 fields should be checked.
The other fields may or may not be null because of muliple items sold at the
same time. I only need to calculate these other fields if they are the only
ones with a value.

Could I do this in code? If so, how do I have the code run when this field
is calculated.


I don't think any code is needed fo that. Just use a text
box expression like:

=Nz(field1, Nz(field2, Nz(field3, field4))) - minprice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top