Update query

  • Thread starter Thread starter Dale
  • Start date Start date
D

Dale

Hi. I know NOTHING About Access.. I have Access 2000.

How do I fill in a field with data when the field is empty. I would so a
search and replace but it does not work on empty fields.

Can anyone help me here? Can you write the query for me?

Thanks in advance.

Dale Allen
 
A little more info will be helpful. Where are you going to get the data to
put into the field? Does it exist in a spreadsheet or another table? Are
other fields in the table already populated?
 
Dale said:
Hi. I know NOTHING About Access.. I have Access 2000.

How do I fill in a field with data when the field is empty. I would so a
search and replace but it does not work on empty fields.

Can anyone help me here? Can you write the query for me?

Thanks in advance.

Dale Allen

It rather depends on what you want to fill the field with. If you mean that
you want all the records to have the same constant value in the field, then
a simple update query will suffice e.g.

UPDATE [people] SET [surname] = "Smith"

which would, somewhat pointlessly, update a field called "surname" in a
table called "people" so that everyone finished up being named "Smith".
 
Hello and thanks for answering so fast...

You are close... The only issue is that I only want to update EMPTY records
in the field name "surname".

Perhaps I just want "The Sales Manager" to be in the field if it is not
already filled with the ral sales managers name. The data is all in the
same table in the same database.

I am sorry I was not more clear about it the first time.

Dale Allen



Baz said:
Dale said:
Hi. I know NOTHING About Access.. I have Access 2000.

How do I fill in a field with data when the field is empty. I would so a
search and replace but it does not work on empty fields.

Can anyone help me here? Can you write the query for me?

Thanks in advance.

Dale Allen

It rather depends on what you want to fill the field with. If you mean that
you want all the records to have the same constant value in the field, then
a simple update query will suffice e.g.

UPDATE [people] SET [surname] = "Smith"

which would, somewhat pointlessly, update a field called "surname" in a
table called "people" so that everyone finished up being named "Smith".
 
Dale said:
Hello and thanks for answering so fast...

You are close... The only issue is that I only want to update EMPTY records
in the field name "surname".

Perhaps I just want "The Sales Manager" to be in the field if it is not
already filled with the ral sales managers name. The data is all in the
same table in the same database.


UPDATE
SET [MyField] = "The Sales Manager" WHERE (ISNULL([MyField])
OR [MyField]='') ;
 
Noozer said:
UPDATE
SET [MyField] = "The Sales Manager" WHERE (ISNULL([MyField])
OR [MyField]='') ;


Or, slightly simpler:

UPDATE
SET [MyField] = "The Sales Manager" WHERE Nz([MyField])=""
 
Back
Top