PC Review


Reply
Thread Tools Rate Thread

Can anyone tell me what is wrong with this IIf statement

 
 
=?Utf-8?B?TnVubyBCZW50bw==?=
Guest
Posts: n/a
 
      26th Oct 2007
I cannot run a query with this iff statement.

All it is meant to do is look at the business and cost centre, return the
integer of someone's age or return their age within the upper and lower
limits of redundancy age.

IIf([oribus]="MainBusiness" And ([oldcostcen]<>"North" Or
[pldcostcen]<>"West"),Int([pnageactual]),Min(Max([Z Redundancy]!Age) Or
Max([pnageactual] Or Min([Z Redundancy]!Age))))

Does anyone have any suggestions as to why this query does not work.

Thanks
Nuno
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      26th Oct 2007
I see several things. You did not say what error messages you are getting.
You may be getting this -- "You tried to execute a query that does not
include the specified expression as part of an aggregate function or
grouping." If so, then it needs to be part of a Totals query, use a sub
query, or a separate Totals query joined in this one.
>>Min(Max([Z Redundancy]!Age) Or Max([pnageactual] Or Min([Z

Redundancy]!Age))))
You can not have minimum of three different fields OR'd like this.

Post the complete query SQL and the error messages.
--
KARL DEWEY
Build a little - Test a little


"Nuno Bento" wrote:

> I cannot run a query with this iff statement.
>
> All it is meant to do is look at the business and cost centre, return the
> integer of someone's age or return their age within the upper and lower
> limits of redundancy age.
>
> IIf([oribus]="MainBusiness" And ([oldcostcen]<>"North" Or
> [pldcostcen]<>"West"),Int([pnageactual]),Min(Max([Z Redundancy]!Age) Or
> Max([pnageactual] Or Min([Z Redundancy]!Age))))
>
> Does anyone have any suggestions as to why this query does not work.
>
> Thanks
> Nuno

 
Reply With Quote
 
=?Utf-8?B?TnVubyBCZW50bw==?=
Guest
Posts: n/a
 
      31st Oct 2007
Hi Karl,

Thanks for your reply. Not sure I know how to apply your solution, but I'll
look into it.

Thanks
Nuno

"KARL DEWEY" wrote:

> I see several things. You did not say what error messages you are getting.
> You may be getting this -- "You tried to execute a query that does not
> include the specified expression as part of an aggregate function or
> grouping." If so, then it needs to be part of a Totals query, use a sub
> query, or a separate Totals query joined in this one.
> >>Min(Max([Z Redundancy]!Age) Or Max([pnageactual] Or Min([Z

> Redundancy]!Age))))
> You can not have minimum of three different fields OR'd like this.
>
> Post the complete query SQL and the error messages.
> --
> KARL DEWEY
> Build a little - Test a little
>
>
> "Nuno Bento" wrote:
>
> > I cannot run a query with this iff statement.
> >
> > All it is meant to do is look at the business and cost centre, return the
> > integer of someone's age or return their age within the upper and lower
> > limits of redundancy age.
> >
> > IIf([oribus]="MainBusiness" And ([oldcostcen]<>"North" Or
> > [pldcostcen]<>"West"),Int([pnageactual]),Min(Max([Z Redundancy]!Age) Or
> > Max([pnageactual] Or Min([Z Redundancy]!Age))))
> >
> > Does anyone have any suggestions as to why this query does not work.
> >
> > Thanks
> > Nuno

 
Reply With Quote
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      31st Oct 2007
You did not post your complete SQL statement as I asked.
--
KARL DEWEY
Build a little - Test a little


"Nuno Bento" wrote:

> Hi Karl,
>
> Thanks for your reply. Not sure I know how to apply your solution, but I'll
> look into it.
>
> Thanks
> Nuno
>
> "KARL DEWEY" wrote:
>
> > I see several things. You did not say what error messages you are getting.
> > You may be getting this -- "You tried to execute a query that does not
> > include the specified expression as part of an aggregate function or
> > grouping." If so, then it needs to be part of a Totals query, use a sub
> > query, or a separate Totals query joined in this one.
> > >>Min(Max([Z Redundancy]!Age) Or Max([pnageactual] Or Min([Z

> > Redundancy]!Age))))
> > You can not have minimum of three different fields OR'd like this.
> >
> > Post the complete query SQL and the error messages.
> > --
> > KARL DEWEY
> > Build a little - Test a little
> >
> >
> > "Nuno Bento" wrote:
> >
> > > I cannot run a query with this iff statement.
> > >
> > > All it is meant to do is look at the business and cost centre, return the
> > > integer of someone's age or return their age within the upper and lower
> > > limits of redundancy age.
> > >
> > > IIf([oribus]="MainBusiness" And ([oldcostcen]<>"North" Or
> > > [pldcostcen]<>"West"),Int([pnageactual]),Min(Max([Z Redundancy]!Age) Or
> > > Max([pnageactual] Or Min([Z Redundancy]!Age))))
> > >
> > > Does anyone have any suggestions as to why this query does not work.
> > >
> > > Thanks
> > > Nuno

 
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
Where is the If statement going wrong? =?Utf-8?B?Sm9hbm5l?= Microsoft Access VBA Modules 5 26th Sep 2006 07:48 PM
Just can't see what's WRONG with this SQL statement?? Jack G Microsoft Access Getting Started 2 11th Jun 2006 06:24 PM
What's wrong with this IIF statement ? =?Utf-8?B?YWxiZXJ0?= Microsoft Access Forms 7 27th Mar 2006 05:31 AM
What is wrong with my SQL Statement =?Utf-8?B?QWx2aW4=?= Microsoft Access Queries 3 6th Jun 2005 08:09 PM
What's wrong with this statement?? Prodip Saha Microsoft ADO .NET 2 14th Jan 2004 03:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:26 PM.