Topic is close. Alternative method found.
Update query using IIf() in a WHERE condition
-
05-08-2022 - |
Question
I am writing an update query in Access which is based on a make table query.
In my temporary table (the output of my make table query), I have 3 fields [Tick], [DivLevel4] and [T]. I can have identical Ticks displaying different values for [DivLevel4] if [T] bears different values (only C or F):
Tick DivLevel4 T
AA 5 C
AA 0 F
BB 2 C
CC 3 C
CC 0 F
How can I incorporate this condition in my update query? I have tried adding an IIf()
statement in the criteria field but it is not doing the job:
IIf([tblTrades].[T]="Y",0,[tbl_DIV_Temp].[[DivLevel4])
as in
UPDATE
tblTrades
INNER JOIN
tbl_DIV_Temp
ON tblTrades.Tick = tbl_DIV_Temp.Tick
SET tblTrades.DIV = [tbl_DIV_Temp].[DivLevel4]
WHERE (((tblTrades.DIV)=IIf([tblTrades].[T]="F",0,[tbl_DIV_Temp].[DivLevel4])));
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow