Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Kendrick, Idaho, USA
    Posts
    277
    Thanks
    1
    Thanked 0 Times in 0 Posts

    conditional Format (2000, XP)

    The number stored in a numerical field can range in size dramatically. I would like number less than 10 to display 2 decimal places, while larger numbers display no decimal places. It doesn't look like Conditional Formatting offers any numerical formatting, so what do you suggest?

    Thanks

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: conditional Format (2000, XP)

    Could you use the following:

    =iif(ControlName<10, format(ControlName,"#,##0.00"), format(ControlName,"#,##0"))

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: conditional Format (2000, XP)

    Probably the simplest approach would be to use an IIF() expression in a query that uses embedded format statements. It would look something like:
    <font color=blue><font face="Georgia">DisplayValue: IIF(myNumber<10,Format(myNumber,"0.00"),Format(myN umber,"0"))</font face=georgia></font color=blue>
    Note however that data displayed in this fashion is not editable. As an alternative, you could also do something similar on a form each time the form's Current event fires but that would require a VBA procedure - a bit more effort, but certainly doable, and then the control would be editable. In that case you might also want to run some code to set the correct format each time the control is updated. You are correct regarding Conditional Formatting.
    Wendell

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Kendrick, Idaho, USA
    Posts
    277
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: conditional Format (2000, XP)

    Thank you both! I always appreciate different ways of tackling the problem.

Posting Permissions

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