Microsoft
Software
Hardware
Network
Question : Want to update a field with values from another field within the same table if it meets a condition
I have: Tablegz
Novice I am at SQL. Using Access 2007.
So I want to fill field FINGP with values from field PROP if PROP has values, everything is within the same table. Note that field PROP does have cells with no data--are empty in other words, not even a zero. If PROP does not have values then FINGP should get filled with the values from field EXG. Right now I get an error for missing an item using the first statement below. Do I even have the right expression for what I am trying to accomplish? Is an IIF statement allowied in an UPDATE?
UPDATE Tablegz
SET ([FINGP]=([EXG], iif([PROP]='')), [FINGP]=[PROP]
or is this more appropriate? SELECT Tablegz, IIF([PROP]=' ', [FINGP]=[EXG]), [FINGP]=[PROP]
However the second expression here asks me to enter a parameter value and if I enter nothing and press OK 3 times it returns 3 empty fields in the following order: Tablegz, Expr1001, Expr1002.
I don't know folks. I need more practice big time.
Your expertise is appreciated.
Answer : Want to update a field with values from another field within the same table if it meets a condition
UPDATE Tablegz
SET FINGP = IIf(Nz(PROP, "") <> "", PROP, EXG)
Random Solutions
NEGATE BIT
Access Query Design Where/Or Criteria Trouble (SQL Where)
How do I limit concurrent IE sessions for a Citrix user on Windows 2003 server?
A serious bug in the MFC exception handling on Windows CE
pause code in sql2008 through Access07
Using subquery to supply VALUE in INSERT statement
Need to return " "
C# WebService (tcp.soap) from Java
Opening explorer with a batch file.
checkbox and listctrl