Sum fields in query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings all. I have a query containing fields of numbers of households
engineered which come from one table. For example, there is a field for
single family units (SFU), multiple dwelling untits (MDU), and commercial
units (CU). For one record there might be 100 SFU, 50 MDU, and 10 CU. I
want to add a column in my query to total the quantity in each field for
every record. I tried using the expression builder, but it does not work for
most of the records. I do not know how to write code, so I am limited to the
query tools. Is there something I am leaving out? I want it to look
something like this:

SFU MDU CU Total
100 50 10 160
200 40 20 260

Is this possible? I could not find anything helpful in past posts that did
not entail writing code I did not understand. Thank you in advance.
 
You should not store sums or any other calculated value in a table. You
should calculate the value anew each time you need to display it. So instead
of looking at your table of rental units, you would look at the result of
this query:

SELECT *, SFU+MDU+CDU as SumUnits FROM [NameOfYourTable]
 
Thanks Ted for taking the time to consider my problem. I should have given
more information. I am running this query to generate a report to some VP's,
not to store in a table. After much more searching I found that the reason
my expression did not work for all rows is that some of the fields had null
values, which apparantly is a no-no for calculations.
 
Back
Top