Results 1 to 6 of 6

Thread: Format (2002)

  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Format (2002)

    I have a query that displays numbers in a field but I can't seem to format it to show cents ie. 170.23. it just shows 170.
    Frank Hoeffer

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

    Re: Format (2002)

    Is the datatype of the field a double or single or currency? Otherwise, it will never show decimal places. If the field is the right datatype, are you doing something in the query to change its format--using a Format function, using a CInt and Clng conversion function, etc.? Are you sure that the fields being displayed without any decimal places actually have decimal portions entered into the underlying table?
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Format (2002)

    Well I changed the datatype to double and the format in the table's property sheet to standard and decimal places to 2. The format is ok with 2 decimal places in tblChartOfAccounts-LineItems but not the the query qryChartOfAccounts where Balance is from the sum of the line Items. Balance has no decimal places.
    I thought you could format expression in a query?
    Frank

  4. #4
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Format (2002)

    If the field you are summing is defined as double then the query results should show decimal places. To format query field, right-click in query design grid in column with sum, select Properties, and specify format as illustrated. This should work whether using Totals query or using an expression to derive the sum.

    HTH
    Attached Images Attached Images

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

    Re: Format (2002)

    If you're summing costs, I would suggest you use a currency datatype. With a double, you will encounter floating point value creep even with simple addition.
    Charlotte

  6. #6
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Format (2002)

    That did it. I keep forgetting about that property sheet dialog that is available to fields in a query.
    Much thanks MarkD and Charlotte.
    Frank

Posting Permissions

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