iif in the criteria

  • Thread starter Thread starter inungh
  • Start date Start date
I

inungh

I have IIF stament in the query criteria and would like return a text
like following

"CURRENT", "PAST", "CURRENT" or "PAST"

It works for single criteria like "CURRENT", "PAST"
It returns no record when it return "CURRENT" or "PAST"

My query criteria like following:

IIf([Forms]![myForm]![cmbMyOption]![value] = 1,"""" + "CURRENT" +
"""" + " OR " + """" + "PAST" + """",IIf([Forms]![myForm]!
[cmbMyOption].[value] = 2, "CURRENT", "PAST"))

I think the problem is the double quotes. I tried many combinations
and put the criteria in the SQL output field which like "CURRENT" or
"PAST".

It works if I put the criteria manually and works for single returns
like "CURRENT".


Your help is great appreciated,
 
I do not follow your criteria -- "CURRENT", "PAST", "CURRENT" or "PAST"
Does the field you are using the criteria on contain multiple words?
Like this --
CURRENT, PAST
CURRENT or PAST

Post sample data.

How many diffferent option from [Forms]![myForm]![cmbMyOption]![value] do
you get?


You migh search on 'Switch'.
 
I do not follow your criteria --  "CURRENT", "PAST", "CURRENT" or "PAST"
Does the field you are using the criteria on contain multiple words?
    Like this --  
CURRENT, PAST
CURRENT or PAST

Post sample data.

How many diffferent option from [Forms]![myForm]![cmbMyOption]![value] do
you get?

You migh search on 'Switch'.

--
Build a little, test a little.



inungh said:
I have IIF stament in the query criteria and would like return a text
like following
"CURRENT", "PAST", "CURRENT" or "PAST"
It works for single criteria like "CURRENT", "PAST"
It returns no record when it return "CURRENT" or "PAST"
My query criteria like following:
IIf([Forms]![myForm]![cmbMyOption]![value] = 1,"""" + "CURRENT"  +
"""" + " OR " + """" + "PAST" + """",IIf([Forms]![myForm]!
[cmbMyOption].[value] = 2, "CURRENT", "PAST"))
I think the problem is the double quotes. I tried many combinations
and put the criteria in the SQL output field which like "CURRENT" or
"PAST".
It works if I put the criteria manually and works for single returns
like "CURRENT".
Your help is great appreciated,- Hide quoted text -

- Show quoted text -

The field only has single data like

CURRENT
PAST
CURRENT
PAST

There are only 2 possibilities
CURRENT and PAST

I need return "CURRENT", "PAST" and "ALL" which include "PAST" and
"CURRENT"

I want 3 options.

First returns "CURRENT", second returns "PAST" and third returns "ALL"

Does IIF function supports return like following

"PAST" or "CURRENT"

Thanks again,
 
Yep.
Try this --
Like IIf([Forms]![myForm]![cmbMyOption]![value] = 1, "CURRENT",
IIf([Forms]![myForm]![cmbMyOption]![value] = 2, "PAST", "*"))

--
Build a little, test a little.


inungh said:
I do not follow your criteria -- "CURRENT", "PAST", "CURRENT" or "PAST"
Does the field you are using the criteria on contain multiple words?
Like this --
CURRENT, PAST
CURRENT or PAST

Post sample data.

How many diffferent option from [Forms]![myForm]![cmbMyOption]![value] do
you get?

You migh search on 'Switch'.

--
Build a little, test a little.



inungh said:
I have IIF stament in the query criteria and would like return a text
like following
"CURRENT", "PAST", "CURRENT" or "PAST"
It works for single criteria like "CURRENT", "PAST"
It returns no record when it return "CURRENT" or "PAST"
My query criteria like following:
IIf([Forms]![myForm]![cmbMyOption]![value] = 1,"""" + "CURRENT" +
"""" + " OR " + """" + "PAST" + """",IIf([Forms]![myForm]!
[cmbMyOption].[value] = 2, "CURRENT", "PAST"))
I think the problem is the double quotes. I tried many combinations
and put the criteria in the SQL output field which like "CURRENT" or
"PAST".
It works if I put the criteria manually and works for single returns
like "CURRENT".
Your help is great appreciated,- Hide quoted text -

- Show quoted text -

The field only has single data like

CURRENT
PAST
CURRENT
PAST

There are only 2 possibilities
CURRENT and PAST

I need return "CURRENT", "PAST" and "ALL" which include "PAST" and
"CURRENT"

I want 3 options.

First returns "CURRENT", second returns "PAST" and third returns "ALL"

Does IIF function supports return like following

"PAST" or "CURRENT"

Thanks again,
 
Back
Top