Using 'OR' as part of an IIf() function

wmphoto

Registered User.
Local time
Today, 17:59
Joined
May 25, 2011
Messages
77
Can someone please let me know if I'm typing this expression all wrong, or if it's even possible to do what I'm trying to do? Any help would be greatly appreciated.

Code:
IIf([Transactions]![Status]='Forecast' OR 'Reconciled' , [Updated Date] , [Original Date])

The objective is that for Transactions which have been forecast or reconciled (with a bank statement) there is an updated date (as a forecast can't be in the past and a reconciled transaction may have a different date from forecast), for the rest, the original date will be use.

My problem is the expression above, always returns the updated date, which for the other transactions is zero. If I remove the 'OR 'Reconciled' bit it works, except now reconciled transactions don't return the updated date.

Thanks in advanced for any help.
 
You could try this:
Code:
IIf([Transactions]![Status]='Forecast' OR ([Transactions]![Status]= 'Reconciled' , [Updated Date] , [Original Date])
 
A tiny adjustment to Bob's code, he mistakenly copied in an opening parens:
Code:
IIf([Transactions]![Status]='Forecast' OR [COLOR=Red][[/COLOR]Transactions]![Status]= 'Reconciled' , [Updated Date] , [Original Date])
The red bit was were the change was made.

You can also use this:
Code:
IIf([Transactions]![Status] IN ('Forecast','Reconciled'), [Updated Date] , [Original Date])
 
vbaInet

Thanks for that. I should have read through my post more carefully after using copy/paste.
 
Tiny, maybe, but it still wouldn't have worked, so thanks anyway.
 
Thanks both of you, the 'IN' version worked perfectly, I'm still not sure what the problem was with 'OR' but I'll bear this in mind next time I want to do something like this.
 

Users who are viewing this thread

Back
Top Bottom