IIF Statement problem

ascaife

Registered User.
Local time
Tomorrow, 08:08
Joined
Nov 10, 2008
Messages
50
Can anyone tell me what I'm doing wrong with this statement:

Location: (IIf([ResidentialAddressCountry]=("") Or IsNull([ResidentialAddressCountry]),"A" & [HomePOCode],"X" & [ResidentialAddressCountry]))

It works if ResidentialAddressCountry is empty, but the else section doesn't work - just gives me #Error
 
Can anyone tell me what I'm doing wrong with this statement:

Location: (IIf([ResidentialAddressCountry]=("") Or IsNull([ResidentialAddressCountry]),"A" & [HomePOCode],"X" & [ResidentialAddressCountry]))

It works if ResidentialAddressCountry is empty, but the else section doesn't work - just gives me #Error

I believe that you have an extra set of () in the formula. Try the following instead:
(IIf([ResidentialAddressCountry]="" Or IsNull([ResidentialAddressCountry]),"A" & [HomePOCode],"X" & [ResidentialAddressCountry]))
(Note that the () has been removed)
 
Or more simply

IIf(nz([ResidentialAddressCountry],"")="","A" & [HomePOCode],"X" & [ResidentialAddressCountry])
 
Last edited:
Thanks guys. No luck on the first one but option 2 worked a treat - good to learn a new one there with nz too.

Much appreciated.

Cheers,

Andrew
 

Users who are viewing this thread

Back
Top Bottom