Automatically populating null fields in zeroes in an acces table

B

Bob

I would like to know how I could construct a query or function that would
automatically add zeros to cells that have are empty (null value). For
example, if customer X has zero sales in May how can I populate the cell with
a zero instead of leaving the cell empty?

Thanks.
 
K

Klatuu

In the query builder for your update query, put this in the Update To line
for each numberic field you want to contvert:

FieldName: SomeNumber

UpdateTo: Nz([SomeNumber],0)

The Nz function returns the first argument is it not null. If it is null,
it returns the value of the second argument.
 
B

Bob

Thanks. Works perfectly.
--
Bob


Klatuu said:
In the query builder for your update query, put this in the Update To line
for each numberic field you want to contvert:

FieldName: SomeNumber

UpdateTo: Nz([SomeNumber],0)

The Nz function returns the first argument is it not null. If it is null,
it returns the value of the second argument.
--
Dave Hargis, Microsoft Access MVP


Bob said:
I would like to know how I could construct a query or function that would
automatically add zeros to cells that have are empty (null value). For
example, if customer X has zero sales in May how can I populate the cell with
a zero instead of leaving the cell empty?

Thanks.
 
J

Jim Burke in Novi

There may be a reason you're not doing this, but you may want to consider
changing the default value for that field to 0 in the table definition.
 
Top