Criteria too complex IIf and Between

  • Thread starter Thread starter MattLe
  • Start date Start date
M

MattLe

I've got a query trying to return only people registerd
during the current season (summer or Winter) and my query
keeps faunching saying the expression is too complex. I
agree, but know of no other way to get it done. Help
please!

IIf(Date() Between [Forms]![frmRules]![SummerStart] And
[Forms]![frmRules]![SummerEnd],Between [Forms]![frmRules]!
[SummerStart] And [Forms]![frmRules]![SummerEnd],Between
[Forms]![frmRules]![WinterStart] And [Forms]![frmRules]!
[WinterEnd]) Returns nothing

Thank you.

-Matt
 
What are you trying to accomplish? This IF statement does not seem to do
anything. If the current date is summer, then...
Between [Forms]![frmRules]![SummerStart] And [Forms]![frmRules]![SummerEnd]
otherwise...
Between
[Forms]![frmRules]![WinterStart] And [Forms]![frmRules]![WinterEnd]



What are you trying to get it to do? You do a test, but your true and false
conditions don't make sense.

Rick B



I've got a query trying to return only people registerd
during the current season (summer or Winter) and my query
keeps faunching saying the expression is too complex. I
agree, but know of no other way to get it done. Help
please!

IIf(Date() Between [Forms]![frmRules]![SummerStart] And
[Forms]![frmRules]![SummerEnd],Between [Forms]![frmRules]!
[SummerStart] And [Forms]![frmRules]![SummerEnd],Between
[Forms]![frmRules]![WinterStart] And [Forms]![frmRules]!
[WinterEnd]) Returns nothing

Thank you.

-Matt
 
I'm sorry about the confusion.
I'm trying to test if today is between summerstart and
summerend, if it is then I need the criteria for the query
to read between summerstart and summerend, otherwise
between winterstart and winterend.

I thought that's what I had created with this statement.
The dates are input on a form called frmRules.
Test:
IIf(Date() Between [Forms]![frmRules]![SummerStart] And
[Forms]![frmRules]![SummerEnd],
True:
Between [Forms]![frmRules]![SummerStart] And [Forms]!
[frmRules]![SummerEnd],
False:
Between [Forms]![frmRules]![WinterStart] And [Forms]!
[frmRules]![WinterEnd])

Thanks again

-Matt
 
I thought that's what I had created with this statement.
The dates are input on a form called frmRules.
Test:
IIf(Date() Between [Forms]![frmRules]![SummerStart] And
[Forms]![frmRules]![SummerEnd],
True:
Between [Forms]![frmRules]![SummerStart] And [Forms]!
[frmRules]![SummerEnd],
False:
Between [Forms]![frmRules]![WinterStart] And [Forms]!
[frmRules]![WinterEnd])

Ah. You can't pass an *operator* such as BETWEEN out of a function
call - only an actual value.

Try instead:

BETWEEN
IIF(Date() BETWEEN [Forms]![frmRules]![SummerStart] And
[Forms]![frmRules]![SummerEnd], [SummerStart], [WinterStart])
AND
IIF(Date() BETWEEN [Forms]![frmRules]![SummerStart] And
[Forms]![frmRules]![SummerEnd], [SummerEnd], [WinterEnd])
 
Back
Top