PC Review


Reply
Thread Tools Rate Thread

CRITERIA FOR AN EXPRESSION

 
 
Alisheba
Guest
Posts: n/a
 
      23rd Apr 2009
I built the following expression in a query:

61+ Last Month: First(IIf([61+DEC1] Is Not Null,[61+DEC1],IIf([61+NOV] Is
Not Null,[61+NOV],IIf([61+OCT] Is Not Null,[61+OCT],IIf([61+SEPT] Is Not
Null,[61+SEPT],IIf([61+AUG] Is Not Null,[61+AUG],IIf([61+JULY] Is Not
Null,[61+JULY],IIf([61+JUNE] Is Not Null,[61+JUNE],IIf([61+MAY] Is Not
Null,[61+MAY],IIf([61+APRIL] Is Not Null,[61+APRIL],IIf([61+MARCH] Is Not
Null,[61+MARCH],IIf([61+FEB] Is Not Null,[61+FEB],IIf([61+JAN] Is Not
Null,[61+JAN])))))))))))))

Under criteria I'm specifying >5000

I keep getting "Expression to complex in query expression" when I run
query. The query works once I remove the criteria.

Any help would be greatly appreciated.

Thank You


 
Reply With Quote
 
 
 
 
KARL DEWEY
Guest
Posts: n/a
 
      23rd Apr 2009
Change your table structure from a spreadsheet with a field for each month to
a record for each month. You can use a union query to rearange the data.

"Alisheba" wrote:

> I built the following expression in a query:
>
> 61+ Last Month: First(IIf([61+DEC1] Is Not Null,[61+DEC1],IIf([61+NOV] Is
> Not Null,[61+NOV],IIf([61+OCT] Is Not Null,[61+OCT],IIf([61+SEPT] Is Not
> Null,[61+SEPT],IIf([61+AUG] Is Not Null,[61+AUG],IIf([61+JULY] Is Not
> Null,[61+JULY],IIf([61+JUNE] Is Not Null,[61+JUNE],IIf([61+MAY] Is Not
> Null,[61+MAY],IIf([61+APRIL] Is Not Null,[61+APRIL],IIf([61+MARCH] Is Not
> Null,[61+MARCH],IIf([61+FEB] Is Not Null,[61+FEB],IIf([61+JAN] Is Not
> Null,[61+JAN])))))))))))))
>
> Under criteria I'm specifying >5000
>
> I keep getting "Expression to complex in query expression" when I run
> query. The query works once I remove the criteria.
>
> Any help would be greatly appreciated.
>
> Thank You
>
>

 
Reply With Quote
 
John Spencer MVP
Guest
Posts: n/a
 
      23rd Apr 2009
You might try an alternate expression like the following
LastMonth: First(NZ([61+Dec1],NZ([61+Nov],NZ([61+OCT],NZ([61+Sept],[61+AUG]))))

But a better solution would probably be to redesign your database structure as
noted elsewhere.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Alisheba wrote:
> I built the following expression in a query:
>
> 61+ Last Month: First(IIf([61+DEC1] Is Not Null,[61+DEC1],IIf([61+NOV] Is
> Not Null,[61+NOV],IIf([61+OCT] Is Not Null,[61+OCT],IIf([61+SEPT] Is Not
> Null,[61+SEPT],IIf([61+AUG] Is Not Null,[61+AUG],IIf([61+JULY] Is Not
> Null,[61+JULY],IIf([61+JUNE] Is Not Null,[61+JUNE],IIf([61+MAY] Is Not
> Null,[61+MAY],IIf([61+APRIL] Is Not Null,[61+APRIL],IIf([61+MARCH] Is Not
> Null,[61+MARCH],IIf([61+FEB] Is Not Null,[61+FEB],IIf([61+JAN] Is Not
> Null,[61+JAN])))))))))))))
>
> Under criteria I'm specifying >5000
>
> I keep getting "Expression to complex in query expression" when I run
> query. The query works once I remove the criteria.
>
> Any help would be greatly appreciated.
>
> Thank You
>
>

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      23rd Apr 2009
On Wed, 22 Apr 2009 19:51:02 -0700, Alisheba
<(E-Mail Removed)> wrote:

>I keep getting "Expression to complex in query expression" when I run
>query. The query works once I remove the criteria.


OUCH.

If this is based on a Table, the table structure IS WRONG.
If it's based on a query calculating the 61+ field, rewrite the query.
For a shorter simpler expression using the current mess, use the NZ() function
instead of the nested IIF:

61+ Last Month:
First(NZ([61+DEC1],NZ([61+NOV],NZ([61+OCT],NZ([61+SEPT],NZ([61+AUG],NZ([61+JULY],NZ([61+JUNE],NZ([61+MAY],NZ([61+APRIL],NZ([61+MARCH],NZ([61+FEB],NZ([61+JAN])))))))))))))

If you have a date-of-birth field you can use it directly to see if the person
reached age 61 during the previous calendar month.
--

John W. Vinson [MVP]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
expression with more than 1 criteria =?Utf-8?B?cmFzY2Fs?= Microsoft Access Queries 3 5th Nov 2006 11:23 PM
data type mismatch in criteria expression when no criteria specified JR Microsoft Access Queries 1 27th Jul 2004 03:47 AM
Criteria expression Microsoft Access Queries 2 9th Jul 2004 01:22 AM
Criteria Expression geohawk Microsoft Access Queries 1 7th Apr 2004 10:45 AM
Re: Macro Error: & "Function is not available in expression in criteria expression" Douglas J. Steele Microsoft Access 1 4th Aug 2003 10:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:37 AM.