Results 1 to 2 of 2
  1. #1
    james1982 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    1

    Smile IIF statement

    I am trying to run a query which will return specific values in a table as they currently currently are i.e internal departments (i.t, sales, procurement, marketing etc) but return all other values as one value i.e all external users (bob, nick, harry etc) as External.



    I think that i may need to use the IIF function. However i cant get it to run as it says that there is a "syntax error in From clause"

    here is my query

    SELECT * INTO zztemp3
    FROM zzztemp2
    IIf ([zzztemp2.deptname]="Admin","Admin",IIF ([zzztemp2.deptname]="Information systems","Infromation systems,IIF ([zzztemp2.deptname]="Administration","Administraton",IIF ([zzztemp2.deptname]="Audit &","Audit &",IIF ([zzztemp2.deptname]="Corporate","Corporate",IIF ([zzztemp2.deptname]="Customer Services","Customer Services,IIF ([zzztemp2.deptname]="Finance","Finance",IIF ([zzztemp2.deptname]= "Health & Safety","Health & Safety,IIF ( [zzztemp2.deptname]="Home delivery team","Home Delivery Team",IIF ([zzztemp2.deptname]="HR","HR",IIF ([zzztemp2.deptname]="Human Resources","Human Resources",IIF ([zzztemp2.deptname]="I.T.","I.T.", IIF ([zzztemp2.deptname]= "Information Technology","Information Technology",IIF ([zzztemp2.deptname]="Inventory","Inventory",IIF ([zzztemp2.deptname]="Operations","Operations",IIF ([zzztemp2.deptname]="PA's Office", "PA'S Office",IIF ([zzztemp2.deptname]="Procurement","Procurement",IIF ([zzztemp2.deptname]="Receipts","Receipts",IIF ([zzztemp2.deptname]="Sales","Sales",IIF ([zzztemp2.deptname]="Stock management","Stock management", IIF ([zzztemp2.deptname]="Stock Audit","Stock Audit",IIF ([zzztemp2.deptname]="Supply chain services","Supply chain services",IIF ([zzztemp2.deptname]="Transport","Transport",IIF ([zzztemp2.deptname]="warehouse","warehouse","External"))))))))))))))) )))));

    Please Help

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    All of your nested IIF's are in the FROM clause. It's no wonder Access is complaining. Frankly I get lost real early in nested IIF's so I rarely use them. Start with a simple SQL statement and then start adding in the additional information.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. nested if statement with two criteria
    By kendra in forum Queries
    Replies: 5
    Last Post: 06-16-2009, 04:07 PM
  2. how to use IF then statement
    By ronnie4 in forum Access
    Replies: 1
    Last Post: 03-17-2009, 11:32 PM
  3. If then statement in query
    By ronnie4 in forum Queries
    Replies: 1
    Last Post: 01-20-2009, 10:49 AM
  4. IF Statement with Minutes
    By sal_gxer in forum Queries
    Replies: 0
    Last Post: 02-12-2007, 08:39 AM
  5. multiple iif statement NEED HELP PLZ
    By scott munkirs in forum Reports
    Replies: 1
    Last Post: 09-27-2006, 05:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums