Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nested if statements

Status
Not open for further replies.

aspnetuser

Technical User
Sep 9, 2004
273
US
is it possible to do the following iif statement:
=IIf(
Code:
=In("ABC","DEK"),Sum([Amt]),0)

I receive a synatax error when trying to compile this?

How can i use In("","",) Etc in a formula?

access 2k

regards,
 
=IIf(
Code:
=In("ABC","DEK"),Sum([Amt]),0)

 would have to be

[code]iif([code] = "ABC", Sum([Amt], iif([code]="DEK", Sum([Amt]),0))

or

Code:
iif([code] = "ABC" or [code]="DEK", Sum([Amt]),0))
 
Or

Sum(iif(
Code:
 = "ABC" or [code]="DEK",[Amt],0))

MOrdja
 
mORDJA, what is the limit on how many OR statements you can do. It works frin for 3 but when i try to do 25 it returns an error...

please advise.
 
aspnetuser,

25 ??? I dont know the limit but from what you say it is less than 25. You could maybe use a switch instead. Although perhaps you should think about a more efficient way to do this, maybe a parameter table.

Mordja
 
I believe a statement can only be 256 characters. Your best bet would be to put these values in a table and then link the query to the table.
 
I have to do for different calculations on the report? with all different codes....

 
You can put all codes in the table in one field and link that field to the
Code:
 field in your current table.
 
i have to calc 4 amount fields based on that one code field all with different crtieria...not sure i follow you...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top