Expression in a query

G

Guest

I am trying to add a "total" expression in a query:

Total: field1-field2+field3

The result shows data for each day of the month for fields1-3, but the
"Total" field only shows results for those days where there's data in all 3
fields. Field1 and Field2 will always have data in them, but Field3 does
not. Do I need to have zeros in the days where there is no data? If so, how
do I do that. I tried writing an "IF" statement IF(Field3="",0,Field3) but I
get errors. Any help would be appreciated.

Patti
 
G

Guest

Thanks, Karl. It worked great!

Another question:
The data in fields1-3 were originally all records in the same field of a
larger "TableA" and I queried them each out to get their individual totals
and saved each into their own query (qryField1, qryField2, qryField3). I
then linked them all to the date field in TableA to create the new query for
my "Total" expression.

Could I have done this from the original TableA. I had originally set those
three records in the criteria, which queried them out, but then didn't know
how to write the expression since one of them needed to be subtracted. If
they had all been summed, it wouldn't have been a problem (I think??)

Hope I explained this clearly.
--
Patti


KARL DEWEY said:
Try this --
Total: Nz([field1],0)-Nz([field2],0)+Nz([field3],0)


PattiP said:
I am trying to add a "total" expression in a query:

Total: field1-field2+field3

The result shows data for each day of the month for fields1-3, but the
"Total" field only shows results for those days where there's data in all 3
fields. Field1 and Field2 will always have data in them, but Field3 does
not. Do I need to have zeros in the days where there is no data? If so, how
do I do that. I tried writing an "IF" statement IF(Field3="",0,Field3) but I
get errors. Any help would be appreciated.

Patti
 

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