Hello,
what i'm trying to do is simple: the user types "201401", and the query has to understand that it's in the 1st quarter, so the period selected will be 201401-201402-201403.
Simple, but I can't do it. I tried with a switch function at first but it didn't work so i moved on nested IIF's, but still no dice.
What i don't want to do:
- give any more parameters (that one [per] is used in many queries that are all linked together)
- put my vars in a form, because i don't want to rely on having a form open, and mostly i don't my queries to stop functionning if the form is deleted/altered
- make a vba module. I can program, but I want these queries to run on their own.
Without furder ado: my expression:
The result is simply empty. I tested separately every piece of it, and it works, but all together it won't even give me my Q1 2014 for "201401", just a blank result.
As the title says, I think i'm messing up the AND keyword somehow.
Thanks in advance.
what i'm trying to do is simple: the user types "201401", and the query has to understand that it's in the 1st quarter, so the period selected will be 201401-201402-201403.
Simple, but I can't do it. I tried with a switch function at first but it didn't work so i moved on nested IIF's, but still no dice.
What i don't want to do:
- give any more parameters (that one [per] is used in many queries that are all linked together)
- put my vars in a form, because i don't want to rely on having a form open, and mostly i don't my queries to stop functionning if the form is deleted/altered
- make a vba module. I can program, but I want these queries to run on their own.
Without furder ado: my expression:
Code:
IIf(Int(Right([per];2))<4;>Left([per];4)*100 And <Left([per];4)*100+4;
IIf(Int(Right([per];2))<7;>Left([per];4)*100+3 And <Left([per];4)*100+7;
IIf(Int(Right([per];2))<10;>Left([per];4)*100+6 And <Left([per];4)*100+10;
IIf(Int(Right([per];2))<13;>Left([per];4)*100+9 And <Left([per];4)*100+13))))
The result is simply empty. I tested separately every piece of it, and it works, but all together it won't even give me my Q1 2014 for "201401", just a blank result.
As the title says, I think i'm messing up the AND keyword somehow.
Thanks in advance.