View Full Version : Help.Query update fields 07


reddogheat
01-29-2010, 07:24 AM
I dont know if this is possible but:
I have a Query running from a linked table.
The query has a field called "binding" which is populated with "p" or "h" or nothing.
I wish to replace the "p" with paperback and the "h" with hardback either in the binding field or into a new field, each time the query is run.

Thank you in advance.

The_Doc_Man
01-29-2010, 07:42 AM
This might be a valid use of nested IIFs because you have only three choices - h, p, or nothing. Look up the IIF function.

It might look like this:

IIF ([binding] = "p", "paperback", IIF ([binding] = "h", "hardcover", "" ) )

In English this reads: If binding is P then use paperback but if binding is H then use hardcover but for binding equal to anything else use an empty string.

NOTE: You could make this more efficient if you knew which one was more likely between P and H and test for the more likely case first.

reddogheat
01-30-2010, 05:37 AM
Thanks Doc Man..that worked well.
Cheers Phin