Puting all the null field to 0

I

Info

Is there anyway to use code to make all the empty/null field update to
0?Thanks for help.
 
A

Allen Browne

You can use an Update query to convert Null values to zero, e.g.:
UPDATE MyTable SET MyField = 0 WHERE MyField Is Null;

Before you do that, you might wish to consider why this is needed. If it is
just that you are having difficulty handling the nulls, see:
Nulls: Do I need them?
at:
http://allenbrowne.com/casu-11.html

Alternatively, if you just need this for a particular situation, you can use
Nz() or IIf() as a calculated field in a query to substitute zeros for nulls
in that context.

If you have lots of repeating fields that contains nulls, such as Client1,
Client2, Client3, or Jan, Feb, Mar, the ultimate solution will be to
redesign this so you have many *records* in a related table, instead of many
repeating fields in one table.
 
I

Info

Em...accually i want all null into 0 because when i print the report i dont
want show null field,i wanna show all to 0 than empty field,thanks for the
help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top