dbTalk Databases Forums  

SUM Function

comp.databases.ms-access comp.databases.ms-access


Discuss SUM Function in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
DS
 
Posts: n/a

Default SUM Function - 10-01-2004 , 07:33 PM






I need to attach an Expression to a unbound text box that says.....

IIf([Quantity Sold]=0,0,=Sum([Quantity Sold])) is the syntex wrong!

But it's not working...basically I have an Unbound Textbox That Sums up
the total of Quantity Sold. But If I don't have a record, the field
comes up blank all though I still have a number that should go in there,
like the starting Inventory. Once I put a record in, it works fine.

Thanks
DS

Reply With Quote
  #2  
Old   
Ken Snell
 
Posts: n/a

Default Re: SUM Function - 10-01-2004 , 07:59 PM






Try this:

=Sum(Nz([Quantity Sold], 0))


--

Ken Snell
<MS ACCESS MVP>

"DS" <bootybox (AT) optonline (DOT) net> wrote

Quote:
I need to attach an Expression to a unbound text box that says.....

IIf([Quantity Sold]=0,0,=Sum([Quantity Sold])) is the syntex wrong!

But it's not working...basically I have an Unbound Textbox That Sums up
the total of Quantity Sold. But If I don't have a record, the field
comes up blank all though I still have a number that should go in there,
like the starting Inventory. Once I put a record in, it works fine.

Thanks
DS



Reply With Quote
  #3  
Old   
DS
 
Posts: n/a

Default Re: SUM Function - 10-01-2004 , 08:10 PM



Ken Snell wrote:

Quote:
Try this:

=Sum(Nz([Quantity Sold], 0))


Thanks,
What does the NZ stand for?
DS


Reply With Quote
  #4  
Old   
Ken Snell
 
Posts: n/a

Default Re: SUM Function - 10-01-2004 , 08:56 PM



The Nz function converts a Null to the value that you specify. So, if the
value of [Quantity Sold] field in any record is Null, a zero is substituted
for the Null. If there are no records at all, the Null value is replaced by
zero.

--

Ken Snell
<MS ACCESS MVP>

"DS" <bootybox (AT) optonline (DOT) net> wrote

Quote:
Ken Snell wrote:

Try this:

=Sum(Nz([Quantity Sold], 0))


Thanks,
What does the NZ stand for?
DS



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.