Board index » delphi » MS Access Nz Function - Null and blank to zero

MS Access Nz Function - Null and blank to zero

Hi there,

I need to run an update query to calculate the total for a row on a MS
Access table after some data is entered. If the user just inputs some
numbers in some cells that is OK as the untouched cells contain zero, the
field default. If, however, the user changes their mind and deletes
something they have already entered and leave the cell empty, it is now a
null value and the update returns zilch.

In the past, I have used the Nz function which returns zero if the value is
blank or null.

I have upgraded to D6 and MS Access 2000 and neither the ADOCommand nor
ADODataSet or BetterADODataSet recognize this function.

Anybody suggest a way around this show stopper.

 

Re:MS Access Nz Function - Null and blank to zero


Quote

>Anybody suggest a way around this show stopper.

I would write a beforePost event to check for Null values and create an
exception if they are found to prevent the records posting.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:MS Access Nz Function - Null and blank to zero


H Ian,

Quote
> In the past, I have used the Nz function which returns zero if the value is
> blank or null.

You can use this instead of Nz:
IIf(IsNull([MyField]),0,[MyField])

Thrse

Other Threads