Summing Memo Fields

S

Steve Welman

Hi

I a busy with a report, in the report I have 2 memo fields which, for the
records I have selcted via a query, contain values.

I am trying to sum these fields but an unable to do so, can anyone help me
with a worlaround to do this.

Thanks in advance.

Steve
 
B

Brian Wilson

Steve Welman said:
Hi

I a busy with a report, in the report I have 2 memo fields which, for the
records I have selcted via a query, contain values.

I am trying to sum these fields but an unable to do so, can anyone help me
with a worlaround to do this.

Thanks in advance.

Steve


If there is a requirement to sum the data then it would be better to
re-design the database to store the values in a more appropriate field. If
you really have no choice, then you will need to create a query. In the
example below, I am expecting to find whole numbers in the field and the sum
will be a whole number. Any non-numeric values will be converted to zero
and any decimal bits will be chopped off. If the values are not whole
numbers, use CSng or CDbl instead of CLng.


SELECT MyID,
Sum(IIf(IsNumeric([MyMemo]),CLng([MyMemo]),0)) AS MySum
FROM MyTable
GROUP BY MyID
 
Top