How put default values in records already exist?

I

Ian Elliott

Thanks in advance.
I have a file where there are many records and many fields
where I need to put zeros in now, and I could do it with a
bunch of copy and pastes, but I would like to do it by
setting the default value (figure this is more precise),
so that any empty cells become zero.
But if I set default to zero, it only does it for new
records made, not records already existing. Anything I can
do?
Thanks again.
 
T

ThunderMusic

Hi,
you could use this query:

update <table_name> Set <field_name> = <default_value> where <field_name> is
null

and replacing <table_name>, <field_name> and <default_value> with the good
values.

I hope it helps

ThunderMusic
 
J

John Vinson

Thanks in advance.
I have a file where there are many records and many fields
where I need to put zeros in now, and I could do it with a
bunch of copy and pastes, but I would like to do it by
setting the default value (figure this is more precise),
so that any empty cells become zero.
But if I set default to zero, it only does it for new
records made, not records already existing. Anything I can
do?

You can run an Update query. If there are multiple fields involved,
you can do it all in one shot by updating each field (I'll assume it's
named FieldX, use your own fieldname of course) to

NZ([FieldX])

This will update the field to 0 if it's NULL (NZ means Null To Zero),
and (wastefully) update it to its current value if not.

Backup first; and Compact your database after running this.
 
V

Van T. Dinh

Default values only work for new Records. For existing
Records, use an Update Query to fix the existing values.

HTH
Van T. Dinh
MVP (Access)
 

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