Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    Unanswered: IIF i could understand this

    can someone help me create a nested if than statement (VBA) out of this IIF, im having big difficulties

    IIf([Int]="I",IIf([used]="1" Or [used]="2" Or [used]="3" Or [used]="A" Or [used]="B" Or [used]="C",IIf([tat]="ment","A",IIf([Qa],"33",IIf([used]="1","1","2")
    )),[used]),[used]) AS PM, IIf([tat]="ment" And [PM]="a" And [used]<>"C",[used],[Pm]) AS [Fm], IIf([playing]="No","*",[FM])

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    select case used
    case = "1"
    ..insert statetments as required
    case else
    end select

    OR

    if used=1 then
    ..insert statetments as required
    elseif used=2 then
    else
    endif

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    I hate these I alway lose count on the (())))(())

    I would write a Function to return the answer

    so

    Code:
    Function  Whatisit(int,used,tat,qa,playing,fm)
    
    if int="1" then
    Select case used
    
    Case "1" Or "2" Or "3" Or "A" Or "B" Or "C"
    
    if ucase(tat)=ucase("ment") then
    Whatisit = "A"
    else
    if qa="33" and used = "1" then
    Whatisit ="1"
    else
    Whatisit ="2"
    End if
    End Select
    Else
    .....
    ....
    ... me getting lost
    
    
    end if
    
    
    End function
    think you get the point

    Then to use it in a Query

    bla : Whatisit([int],[used],[tat],[qa],[playing],[fm])
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •