Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

varying decimal places

Discussion in 'Information Technology' started by julie_b, Jul 28, 2006.

  1. julie_b

    julie_b
    Expand Collapse
    Guest

    I have a report that displays a numeric value from a query (the query
    contains a calculation). I want to display the numbers on the report with a
    maximum of one decimal place. If the value is an integer, I don't want the
    report to display "x.0". Is there any way for me to control this through
    either the query or the report?
     
  2. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    In a report, you can set the ControlSource of your text box to an expression
    that generates the number as a string formatted the way you want, e.g.:

    =IIf([MyNum] = Int([MyNum]), Format([MyNum], "#,##0"), Format([MyNum],
    "#,##0.0")

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "julie_b" <julieb@discussions.microsoft.com> wrote in message
    news:B43FA918-9A02-42A3-93A2-3AA9D09BB738@microsoft.com...
    >I have a report that displays a numeric value from a query (the query
    > contains a calculation). I want to display the numbers on the report with
    > a
    > maximum of one decimal place. If the value is an integer, I don't want
    > the
    > report to display "x.0". Is there any way for me to control this through
    > either the query or the report?
     

Share This Page