Add fields with null value

R

renold1958

Have a query with 2 fields.
1. Price
2. GST

Now I need to create a field wich adds both of them up.

TotalCost:[price]+[gst]

All works fine, except when there is no value in the GST
field for a record, so the TotalCost for that record adds
up to null aswell.

Forgot what to put before [gst], when there is no value in
that field, but it still gives me a TotalCost value.

Thanks
 
A

Allen Browne

Nz() allows you to specify a value to use for null, e.g.:
TotalCost: CCur(Nz([price], 0) + Nz([gst],0))

A better idea would be to store the GstRate for each record, rather than the
GST amount. This avoids the dependency between the Price and GST fields.
 
Top