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

    Iif Statement Formatting (2003)

    Hi, I have the following calculated field in a query: Lifetime: IIf([Depreciation Rate]>0,100/[Depreciation Rate]*12,""). I want to try and format the result of this into a whole number (e.g. 180), but the field seems to think its a date and it doesn't work - can anyone tell me why this is happening?

    Cheers.

    Ina

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

    Re: Iif Statement Formatting (2003)

    In the first place, I would change the expression to

    Lifetime: IIf([Depreciation Rate]>0,100/[Depreciation Rate]*12,Null)

    The "" you have is a string, it's not a good idea to mix numbers and strings in a field.

    In the second place, try setting the Format property of the field to Fixed and the Decimal Places property to 0, or else set the Format property to 0.

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

    Re: Iif Statement Formatting (2003)

    Cheers - result was changing to null stopped the format property thinking it was dealing with a date, however, the field property still does not allow me to choose a Fixed format (drop down box appears null). Its probably just because it's Monday!

    Ina

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

    Re: Iif Statement Formatting (2003)

    Try typing a 0 (zero) in the Format property.

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

    Re: Iif Statement Formatting (2003)

    Sorry Hans, misread the last part of your original mail. Thanks - that works.

    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
  •