update query avoiding null values

G

Guest

I have two tables: Table1 & Table2
Table 1 contains a personal data for clients (name, address, phone number)
Table 2 contains the same exact fields as Table 1, but includes only updates
to the personal data for clients (I receive periodic files with new
information)

I would like to run an update query that wil update the fields in Table 1
with the new information in Table 2. However, for some clients, I only have
limited information, meaning some fields in Table 2 are randomly blank. When
I run the query, I don't want the fields in Table 1 to be replaced with null
values. Instead, I would like for the update query to update fields in Table
1 only if the corresponding fields in Table 2 are not null.

I tried to add "is not null" criteria, but of course, that criteria for any
field will only allow the query to update cases that do not have a null value
in that particular field. The problem is that the null fields I'm trying to
avoid are random and not any particular field.

Any solutions, or am I asking too much of the update query?

Thanks for you help!!
 
S

Steve

In your Update query, in the Name field, where it says Update To, put this
expression:
NZ(Table2.Name,Table1.Name)
Do the same for the Address field and Phone Number field.

Notes:
1. Name is a reserved word and should not be used for a field name. You
need to change the name of the Name field.
2. It is inadvisable to have field names with a space in the name. While
changing the Name field, also change the Phone Number field name.

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

Guest

Worked like a charm!! Thanks you so much!!

And, I will take your advice on the field names!

THANKS!
 

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

Similar Threads

Appending null data and moving! 4
Update Query Help *urgent* 0
Update Query 4
update query 2
update query 2
select query not null 7
Null or NOT in another table 4
update query w some fields null 1

Top