Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF and IsNull with OR problem in query grid 1

Status
Not open for further replies.

zathrus777

Programmer
Mar 31, 2003
30
GB
I have two colums National rate 1 and 2 which if either or both have a value in needs to have Listed in a third column else Loadbanded.

This works but I cant work out why so I supect a bug:

Listed/Loadbanded: IIf(((IsNull([FE_ANNUAL_VALUES]![NATIONAL_RATE1] And IsNull([FE_ANNUAL_VALUES]![NATIONAL_RATE2])))
Or
(IsNull([FE_ANNUAL_VALUES]![NATIONAL_RATE1] Or IsNull([FE_ANNUAL_VALUES]![NATIONAL_RATE2])))),"Loadbanded","Listed")

The first part is my check for any value in both and the second for either of the columns. Is there a is not null?

Thanks
 
You don't need the AND part of the statement. The OR will handle the condition where one or the other or both are true.
[blue][tt]
Listed/Loadbanded:
IIf( IsNull([FE_ANNUAL_VALUES]![NATIONAL_RATE1])
Or IsNull([FE_ANNUAL_VALUES]![NATIONAL_RATE2]),
"Loadbanded",
"Listed")
[/tt][/blue]
If there is a possibility that either value could be an empty string (i.e. '') then you may want to test for that as well. Note that an empty string is not the same as NULL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top