Adding zeros to empty cells?

forbsey

New member
Local time
Yesterday, 21:44
Joined
Feb 20, 2007
Messages
5
Is there any way I can automatically add zeros to cells with no value?
 
yea set the default to 0 in the table design
 
Now is the time to be very careful.

What is it that you wish to do? Do you wish to display 0 when the field is Null, or do you wish to replace all Nulls with 0.

The latter is best done with a query, but it will then alter the values permanently

update mytable set myfield = 0 where myfield is null

the first can easily be achieved by altering the format of either the field or control in question.

Playing with the format, numbers can have four formats, where the first is format when positive, the second is format if negative, the third is format when 0, the fourth is format when Null. So, let's say you're doing thousand separator, then you could try pasting this into the format property of either the field or control

#,##0.00;[Red]-#,##0.00;0;0
 
I cant get it work because I have imported an Excel file into Access which has a lot of empty cells. It will only add default zeros to any additional records which are added, it won't assign zeros to existing blank cells. Is there any way of doing this? (there are over 2000 records with 7 columns for each, dont really want to have to do this manually!)
 
You could also use the NZ function to change the null values to zero

Nz([FieldName],0)
 

Users who are viewing this thread

Back
Top Bottom