Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jul 2006
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    conditional queries (2002)

    Hi Hans, sorry - my questions are probably pretty unchallenging for you - but your answers are a great help to a newbie.

    I'm trying to write a query which will say If depreciation is => cost, return a value of 8, if depreciation is < cost, return a value of 1, and if depreciation is null, return "". Having problems with it - can you help? Thanks. Ina

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: conditional queries (2002)

    Hi Ina,

    You can add a calculated column to the query using nested IIf functions:

    SomeName: IIf(IsNull([Depreciation]),Null,IIf([Depreciation]<[Cost],1,8))

    Change SomeName to the name you want this field (column) to have.

    PS: Please don't direct your questions directly at me - I may be the most prolific poster in this forum, I'm not the only one! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  3. #3
    Star Lounger
    Join Date
    Jul 2006
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: conditional queries (2002)

    Oops! No offence meant - simply didn't realise!

    Thanks for help.

    Ina

Posting Permissions

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