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
Fonts not appearing in MSPaint
Moving shared printers from one server to a new one
Access 2002 Navigation
lookout settings keep resetting to default / outlook 2003
How do I migrate local users accounts from Windows Server 2003 R2 to a new one?
2 conditions where
Access other cell data on current row in an Excel Function
Excel Average Need to ignore #n/a values
Tree command in DOS
Outlook 2007 client prompts for password in exchange 2007 environment