IIF() in MS Access query

R

rock

Dear All,

I am working on a MS Access Select query where I am using an IIF()
function


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],'LOW')



Output: If condition is TRUE then it works, but when condition is
false it will return nothing.


I have also tried


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],"LOW")



Regsrds,
Shital
 
G

Guest

Output: If condition is TRUE then it works, but when condition is
false it will return nothing.

Do you mean that it works when true only or that this is what you want it to
do ?

If it only works when true then you need to tell it what to do when not
true. In other words there should be an else statement attached to the code.

Hope this helps
--
Your help is appreciated
Thank You


rock said:
Dear All,

I am working on a MS Access Select query where I am using an IIF()
function


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],'LOW')



Output: If condition is TRUE then it works, but when condition is
false it will return nothing.


I have also tried


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],"LOW")



Regsrds,
Shital
 
B

Brian Bastl

rock,
syntax looks funny to me.

if either [dbo_loc] or [TRHazardZones] is a table name, then try using a dot
as the separator, not a bang.
if either are form names, then you should preface it with "[Forms]!"

HTH,
Brian


Dear All,

I am working on a MS Access Select query where I am using an IIF()
function


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­
­ZONES],'LOW')



Output: If condition is TRUE then it works, but when condition is
false it will return nothing.


I have also tried


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­
­ZONES],"LOW")



Regsrds,
Shital
 
R

rock

Thanks Phill,

the problem here is

1. It works only when condition is true

2. if condition is false it should return "LOW", but it won't

regards,
Shital

Output: If condition is TRUE then it works, but when condition is
false it will return nothing.

Do you mean that it works when true only or that this is what you want itto
do ?

If it only works when true then you need to tell it what to do when not
true. In other words there should be an else statement attached to the code.

Hope this helps
--
Your help is appreciated
Thank You


rock said:
Dear All,

I am working on a MS Access Select query where I am using an IIF()
function


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],'LOW')



Output: If condition is TRUE then it works, but when condition is
false it will return nothing.


I have also tried


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],"LOW")



Regsrds,
Shital
 
S

SusanV

Is the field you're trying to populate text?

Thanks Phill,

the problem here is

1. It works only when condition is true

2. if condition is false it should return "LOW", but it won't

regards,
Shital

Output: If condition is TRUE then it works, but when condition is
false it will return nothing.

Do you mean that it works when true only or that this is what you want it
to
do ?

If it only works when true then you need to tell it what to do when not
true. In other words there should be an else statement attached to the
code.

Hope this helps
--
Your help is appreciated
Thank You


rock said:
Dear All,

I am working on a MS Access Select query where I am using an IIF()
function


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],'LOW')



Output: If condition is TRUE then it works, but when condition is
false it will return nothing.


I have also tried


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],"LOW")



Regsrds,
Shital
 
R

rock

ya Sussan,

I want to populate text as "false expression"

thanks,
Shital
Is the field you're trying to populate text?

Thanks Phill,

the problem here is

1. It works only when condition is true

2. if condition is false it should return "LOW", but it won't

regards,
Shital

Output: If condition is TRUE then it works, but when condition is
false it will return nothing.

Do you mean that it works when true only or that this is what you want it
to
do ?

If it only works when true then you need to tell it what to do when not
true. In other words there should be an else statement attached to the
code.

Hope this helps
--
Your help is appreciated
Thank You


rock said:
Dear All,

I am working on a MS Access Select query where I am using an IIF()
function


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],'LOW')



Output: If condition is TRUE then it works, but when condition is
false it will return nothing.


I have also tried


IIf([dbo_loc]![POSTALCODE]=[TRHazardZones]![POSTALCODE],[TRHazardZones]![TR­­ZONES],"LOW")



Regsrds,
Shital
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top