Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Negative & Positive numbers (Access2k)

    Is it possible to ubdate a positive number as a negative number using a formula in queries?
    If yes tell me how PLEASE??

    I already have this query
    UPDATE TradeX SET TradeX.moneyspot = (([tp]*0.01)*[q])
    WHERE (((TradeX.tccy)="GBP"));

    but I want to do this as well
    if Expence then -[tp]*[q] else [tp]*[q]
    Can this be done in an Update query??

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

    Re: Negative & Positive numbers (Access2k)

    Sorry, but you lost me. WHERE are you trying to do the substitution, in the SQL you posted or somewhere else? Are you trying to set the moneyspot field to a negative conditionally or are you trying to do something else?

    The simple answer is that yes, it is possible using an IIf, but without a clearer explanation, no one can write it for you.
    Charlotte

  3. #3
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Negative & Positive numbers (Access2k)

    I am trying to do it in the SQL I've posted and yes I am trying to set the moneyspot feild to negative conditionally.

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

    Re: Negative & Positive numbers (Access2k)

    But the SQL you posted doesn't contain the expression you were trying to change to a negative.
    Charlotte

  5. #5
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Negative & Positive numbers (Access2k)

    I know charlotte,
    I am gonna add another feild which is called INC/EXP and if its an income then it will have Inc and for expence Exp.

  6. #6
    Lounger
    Join Date
    Nov 2001
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Negative & Positive numbers (Access2k)

    Why can't you have two seperate fields, one for income one for expenditure and just deduct one from the other?

  7. #7
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Negative & Positive numbers (Access2k)

    I wish it was as simple as that but It doesn't work like that Rich! <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

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

    Re: Negative & Positive numbers (Access2k)

    Which condition is going to make the result negative?
    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
  •