A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Nested IIf: Define ranges, = And =?



 
 
Thread Tools Display Modes
  #1  
Old July 8th, 2008, 09:36 AM posted to microsoft.public.access.queries
CanonMaiden
external usenet poster
 
Posts: 7
Default Nested IIf: Define ranges, = And =?

I'm trying to create a commission rate by defining several ranges based on
the Sale_Price field's value.
I am creating a calculated field in a query with the following syntax (for
lack of a BETTER word)

Rate: IIf(([Sale_Price]0 And [Sale_Price]50,".30"),
IIf([Sale_Price]=50 And [Sale_Price]=299.99,".25"),
IIf([Sale_Price]=300 And [Sale_Price]=999.99,".20"),
IIf([Sale_Price]=1000,".15","99"))))

I've tweaked this code every way I can think of, currently I'm receiving an
error that reads "The expression you entered contains a function with the
wrong number of arguments" I'm guessing that is a wordy way of telling me
unbalanced parentheses....
Thanks in advance to all the nice people out there who take the time to
answer our questions.
  #2  
Old July 8th, 2008, 10:04 AM posted to microsoft.public.access.queries
Dennis
external usenet poster
 
Posts: 1,222
Default Nested IIf: Define ranges, = And =?

Rate: IIf([Sale_Price]0 And [Sale_Price]50,".30",IIf([Sale_Price]=50 And
[Sale_Price]=299.99,".25",IIf([Sale_Price]=300 And
[Sale_Price]=999.99,".20",IIf([Sale_Price]=1000,".15","99"))))

"CanonMaiden" wrote:

I'm trying to create a commission rate by defining several ranges based on
the Sale_Price field's value.
I am creating a calculated field in a query with the following syntax (for
lack of a BETTER word)

Rate: IIf(([Sale_Price]0 And [Sale_Price]50,".30"),
IIf([Sale_Price]=50 And [Sale_Price]=299.99,".25"),
IIf([Sale_Price]=300 And [Sale_Price]=999.99,".20"),
IIf([Sale_Price]=1000,".15","99"))))

I've tweaked this code every way I can think of, currently I'm receiving an
error that reads "The expression you entered contains a function with the
wrong number of arguments" I'm guessing that is a wordy way of telling me
unbalanced parentheses....
Thanks in advance to all the nice people out there who take the time to
answer our questions.

  #3  
Old July 8th, 2008, 10:37 AM posted to microsoft.public.access.queries
CanonMaiden
external usenet poster
 
Posts: 7
Default Nested IIf: Define ranges, = And =?

No fiar! I tried that, I swear!
Thanks, Dennis.

"Dennis" wrote:

Rate: IIf([Sale_Price]0 And [Sale_Price]50,".30",IIf([Sale_Price]=50 And
[Sale_Price]=299.99,".25",IIf([Sale_Price]=300 And
[Sale_Price]=999.99,".20",IIf([Sale_Price]=1000,".15","99"))))

"CanonMaiden" wrote:

I'm trying to create a commission rate by defining several ranges based on
the Sale_Price field's value.
I am creating a calculated field in a query with the following syntax (for
lack of a BETTER word)

Rate: IIf(([Sale_Price]0 And [Sale_Price]50,".30"),
IIf([Sale_Price]=50 And [Sale_Price]=299.99,".25"),
IIf([Sale_Price]=300 And [Sale_Price]=999.99,".20"),
IIf([Sale_Price]=1000,".15","99"))))

I've tweaked this code every way I can think of, currently I'm receiving an
error that reads "The expression you entered contains a function with the
wrong number of arguments" I'm guessing that is a wordy way of telling me
unbalanced parentheses....
Thanks in advance to all the nice people out there who take the time to
answer our questions.

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.