Sum command on Field displaying - value.

L

Leon

Please help. I have the following code in a field on one
of my forms. =Sum(
Code:
 Like "C*")

Basically I want it to total all codes beginning with C on
the form. For some reason the value returned is coming up
minus? (Although the figure is correct) For instance -1324
instead of just 1324.

I wondered if I was missing something very simple?

Thanks for any help you might be able to offer.
 
J

Joan Wild

Code must be text if you are using 'Like "C*". One cannot 'sum' on a text
field. Perhaps what you really mean is to count them?

Sum is working because for each record that is like C*, Code will = true.
True in Access is -1; summing them will therefore get you the correct
number, but negative.

Either use Abs() around your expression, or use Count instead.
 
L

Leon

Thanks ever so much.
Regards

Leon
-----Original Message-----
Code must be text if you are using 'Like "C*". One cannot 'sum' on a text
field. Perhaps what you really mean is to count them?

Sum is working because for each record that is like C*, Code will = true.
True in Access is -1; summing them will therefore get you the correct
number, but negative.

Either use Abs() around your expression, or use Count instead.

--
Joan Wild
Microsoft Access MVP

Please help. I have the following code in a field on one
of my forms. =Sum(
Code:
 Like "C*")

Basically I want it to total all codes beginning with C on
the form. For some reason the value returned is coming up
minus? (Although the figure is correct) For instance - 1324
instead of just 1324.

I wondered if I was missing something very simple?

Thanks for any help you might be able to offer.
[/QUOTE]


.
[/QUOTE]
 

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