Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2008
    Posts
    7

    IIF clause

    Can you help me build the right IIf field in the query with the following conditions :



    The field DDU consissts of :
    DDU :[exworks]*2+0,4+0,01

    To the above expression i must also add 0,001 if size = 205, etc according to the following table :


    205 0.001
    60 0.001
    20 0.009
    1 1.32
    4 0,32
    0,5 1,67

    However Acces does not accept my query, obvioulsy i have errors :


    DDU : [exworks]*2+0,4+0,01 + IIf([size = 205],0,001,[size = 60],001)

    Will you help me ?

  2. #2
    jya is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2007
    Location
    Chicagoland
    Posts
    109
    You may be better off with a Switch statement. Have you tried something like this?

    DDU: [exworks]*2+0.4+0.01+Nz(Switch([size]=205,0.001,[size]=60,0.001,[size]=20,0.009,[size]=1,1.32,[size]=4,0.32,[size]=0.5,1.67))

    I added a Nz() around the switch function in case size does not match any of those listed. I'm assuming that 0,4 is similar to 0.4

    Hope this helps.

  3. #3
    Join Date
    Feb 2008
    Posts
    7

    Thank you !

    Thank you so much for the great help ! I will use it now in my queries !

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

Similar Threads

  1. FROM Clause error message
    By skylite in forum Queries
    Replies: 2
    Last Post: 10-23-2008, 05:47 AM
  2. Replies: 1
    Last Post: 07-17-2006, 06:30 AM
  3. Help on WHERE clause
    By QBCM in forum Programming
    Replies: 1
    Last Post: 12-19-2005, 08:43 PM

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