Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Oct 2002
    Location
    Ravenna, Ohio, USA
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IIF Functions (Access 97)

    Every where I look I

  2. #2
    Lounger
    Join Date
    Feb 2001
    Location
    Torn between Kent & Essex, England
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF Functions (Access 97)

    What context are you using this expression? In a query, on a form or in code?

  3. #3
    New Lounger
    Join Date
    Oct 2002
    Location
    Ravenna, Ohio, USA
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF Functions (Access 97)

    This would be a Form or Code

  4. #4
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Atlanta, Georgia, USA
    Posts
    274
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF Functions (Access 97)

    Try this:
    iif([txtHOLD]=TRUE,"Hold",iif([txtRENT]=true,"Rent",""))
    The falsepart can be another if statement. The falsepart of your last if statement would contain the ""
    Scott

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF Functions (Access 97)

    If you're doing this in Code, you should probably use a standard IF statement in the appropriate event (such as OnChange() or OnCurrent()):<pre>If chkHold AND NOT chkRent Then
    txtResult = "Item on HOLD"
    Elseif NOT chkHold AND chkRent Then
    txtResult = "Item on Rent"
    Else
    txtResult = ""
    End If</pre>

    Hope this helps

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: IIF Functions (Access 97)

    IIF statements are really designed for queries. The IF-End IF and SELECT CASE structures available in code are vastly preferable and much easier to disentangle than nested IIFs. Don't be persuaded that it's better to have everything on a single line. It buys you virtually nothing in modern programming languages and makes code much harder to maintain.
    Charlotte

Posting Permissions

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