# Thread: Need help calculating in form

1. Registered User
Join Date
Mar 2004
Posts
19

## Unanswered: Need help calculating in form

I am trying to calculate extended and total cost of 10 different items. As it is now I have the Extended Cost {=Qty#*Cost#} and then Total Cost {=Ecost1+2+3+4+5+6+7+8+9+10} of course Ecost is in front of all the numbers.

It works great if I have a value in every Qty and Cost sections but I need it to calculate Total Cost even if there is only a few Ecosts. I tried to make the default valve of all Qty, Cost, and Ecost sections at 0 and still nothing.

Please help. I would really rather not have zeros in all those feild so if there is a way to avoid this that would be the ideal situation.

2. Registered User
Join Date
Nov 2003
Location
Europe
Posts
369

## Re: Need help calculating in form

Originally posted by sbook73
I am trying to calculate extended and total cost of 10 different items. As it is now I have the Extended Cost {=Qty#*Cost#} and then Total Cost {=Ecost1+2+3+4+5+6+7+8+9+10} of course Ecost is in front of all the numbers.

It works great if I have a value in every Qty and Cost sections but I need it to calculate Total Cost even if there is only a few Ecosts. I tried to make the default valve of all Qty, Cost, and Ecost sections at 0 and still nothing.

Please help. I would really rather not have zeros in all those feild so if there is a way to avoid this that would be the ideal situation.
Try to use =Nz(yourcontrolorfieldname,0)

Example:
lAmount = Nz(rstTrans!amount_of_shares_bought, 0)

This sets a 0 (zero) instead of returning nothing. You can use that one inside your formulas, I think. Not sure if you can do it right on the text box control, or need to calculate using it though VBA, but think you should be able to use that Null check right on the form.

D.

3. Registered User
Join Date
Mar 2004
Posts
19
I have attached a example DB of what I am trying to do. If anyone could look at it and give me any tips that would be great.

I have got it to do the calculations but I still have zero's if nothing is added. I need the feilds with nothing added to remain blank but if I change the default value to nothing the calculations don't work.

Last edited by sbook73; 04-15-04 at 22:18.

4. Registered User
Join Date
Mar 2004
Posts
19
Sorry posted the wrong zip file. Here is the correct one.

5. Registered User
Join Date
Mar 2004
Posts
19
Still unable to get rid of the zeros starting to get a headache from banging my head up against the wall.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•