Update Query Without Replacing Text

K

KLock

I have several update queries to identify different scenerios and update a
comment in the same field. However some of these scenerios can fit for the
same record. Is there a way to keep what the field updated in the first
query with what it would update in the second qeury.
Example
Query 1 - Update FieldC to "FieldA Null" if FieldA is null
Query 2 - UPdate FieldC to "FieldB Null" if FieldB is null
However if both FieldA and FieldB is Null I want FieldC to keep "FieldA
Null" and add "FieldB Null". Instead of replacing the "FiledA Null" with the
update "FieldB Null"

I have more then two queries so just creating a third query to overwrite the
field would not be efficient.
 
K

KARL DEWEY

Put this in the Update To field --
[FieldC] & IIF([FieldB] Is Null, " FieldB Null", "")

You could do it all in the one query by nesting IIFs.
 
J

John Spencer

UPDATE SOMETABLE
SET FIELDC = (IIF([FieldA] is Null, "FieldA Null",Null) + " ") &
IIF([FieldB] is NULL,"FieldB Null",Null)
WHERE FieldA is Null Or FieldB is Null

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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


Top