Substraction of 2 Records with 1 record with no data

L'apprentis

Redcifer
Local time
Today, 15:05
Joined
Jun 22, 2005
Messages
177
This is a code I used for a stock control form:

"Balance" =[QuantityReceived]-[Stock record table Subform].Form!SumQtyIssued

It is just a simple substraction between a record from a field and a sum of records from an another field contained in a subform.
The code is working fine apart for the following situation:

If there is no data, yet in the subform;the value for the "Balance" which should be Just equal to [QuantityReceived] appears for 1/2 a sec and disappear!!????

Just now, my knowledge is pretty poor with codes but what i guess is that Access start the calculation fine, then realised that there is no data in the subform and then cancel the calculation.
How can you set the value of a field to 0 or cancel that part of the equation if there is no record for that field?
 
Last edited:
Try the NZ() function.

"Balance" =[QuantityReceived]-NZ([Stock record table Subform].Form!SumQtyIssued)

Bonne chance!
 
Superb!
Merci a toi Newman et vive le Quebec!
 

Users who are viewing this thread

Back
Top Bottom