Populate Blank Results as 0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query where the results are either populated with some number, or
blank. I would like to populate the blank cells with the number 0 so that I
can calculate later. Is there any way that I can tell my query to treat
blank results as 0?

Thanks!
 
Check help for more information about the Nz function. In general,
something like this at the top of a blank column in query design view:
NewField: Nz([OldField],0)
Then use NewField in place of OldField in expressions, etc.

You may do better, though, to use an update query to covert nulls to 0, and
to use 0 as the default value for new records.
 
the nz() function will convert null to zero.
this could be used in the query, or in the calculate function later such as
total=total+nz([field1])

hth,
James Deckert
 
You don't need to set the blank records to 0. Look at the NZ function in the
Help file. It looks like this:
NZ([MyField],0)
The NZ function returns the value of MyField if MyField is not null and
returns 0 if MyField is null. You would use the NZ function in your
calculation.

Example:
MyTotal = NZ([MyField1],0) + NZ([MyField2],0) + NZ([MyField3],0)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
Back
Top