Iff Statement Question

J

Joshua McLemore

Hello,

I'm trying to use the following 'Iff' statement and it's not working out for
me.

Iff(([tblCrew_Event_Matching]![Event]=Yes),([tblCrew_Event_Matching].[Event/Room])=[Forms]![frm
All Events]![Event Name],([tblCrew_Event_Matching].[Event/Room])=[Forms]![frm
All Events]![Part 1 Location])

I'm using this in a query and need it to make the query criteria equal one
or the other values being pulled from a form.

Thanks for any help!
 
K

Ken Snell \(MVP\)

First, the function is IIf, not Iff.

Second, what type of field / format is the Event field in the
tblCrew_Event_Matching table? Is it a text field? A boolean field? something
else?

Third, in what context are you trying to use this expression? On a form? As
a table-level validation in ACCESS 2007? Somewhere else?
 
J

Joshua McLemore

Hi Ken,

The "IFF" to "IIF" change made a really nice difference!! I don't have it
working quite right yet, but I'm now on the way. Thank you so much!

Just FYI ... it's a text field and I'm using it as the control in a combo
field sql statement to pick "this" but if that is null, pick "that."

Thanks again!
--
Joshua


Ken Snell (MVP) said:
First, the function is IIf, not Iff.

Second, what type of field / format is the Event field in the
tblCrew_Event_Matching table? Is it a text field? A boolean field? something
else?

Third, in what context are you trying to use this expression? On a form? As
a table-level validation in ACCESS 2007? Somewhere else?
--

Ken Snell
<MS ACCESS MVP>




Joshua McLemore said:
Hello,

I'm trying to use the following 'Iff' statement and it's not working out
for
me.

Iff(([tblCrew_Event_Matching]![Event]=Yes),([tblCrew_Event_Matching].[Event/Room])=[Forms]![frm
All Events]![Event
Name],([tblCrew_Event_Matching].[Event/Room])=[Forms]![frm
All Events]![Part 1 Location])

I'm using this in a query and need it to make the query criteria equal one
or the other values being pulled from a form.

Thanks for any help!
 
J

John W. Vinson

Just FYI ... it's a text field and I'm using it as the control in a combo
field sql statement to pick "this" but if that is null, pick "that."

You don't even need IIF for that purpose: the NZ function converts NULL to any
chosen value.

=NZ([This], [That])

will return the value in This if there is a non-null value, and if This is
null it will return That.
 

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

Similar Threads

Null Criteria Problem 4
IFF Statement 6
IIf statement in Query 2
Undefined function 'IFF' in expression 2
Join / Iff Question 1
List boxes, functions and query criteria 9
IFF in Criteria 6
ADO Problem 4

Top