Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Problem

Status
Not open for further replies.

JasonLiew

Programmer
Oct 15, 2001
37
SG
Erm.... hi,

Can anyone tell me how to code this thingy?


I used 2 different sub-form so it is quite troublesome. I have done something but it only works when ID is enter in both sub-form. ID is an unique key to identify products. If 1 sub-form is left out then it will not calculate.

I want to sum the [Order Quantity] from table [Details] minus Sum of [Quantity Receive] in table [Details2]

Balance: Sum([Details]![Order_Qty] - [Details2]![QTY Receive]) /*It is to calculate the balance*/
 
Jason,

This is a problem caused by null. Any operation performed on a Null returns null. To stop this, you need to use the function Nz(Value, OptionalReturnValue)

So assuming you need a value of 0....

Sum(Nz([Details]![Order_Qty],0) - Nz([Details2]![QTY Receive],0))

Help?

Craig
 
Hi Craig,

Thanks for the suggestion.
Where can I put the function Nz(Value, OptionalReturnValue)?

[bigsmile]
Jason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top