Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2002
    Location
    Alaska
    Posts
    19

    Unanswered: Decimal Problem - Prevent Rounding?

    I'm using the following expression inside a query:

    ElapsedDays: =DateDiff("y",[OldestDate],[LatestDate])

    I'm wanting to use this number (ElapsedDays) to calculate the average mean time based on months, i.e.,

    MTBFMonths: [ElapsedDays]\30.4

    Example: 179\30.4 should equal 5.88

    My report field shows this calculation as: 6.00

    No matter what I've tried, it rounds the number to the nearest whole number. When I set the report field properties to fixed, and or set the Decimal Places to "2"....it still rounds the number. I know they say it's best to change the format properties in the underlying table, but this number comes from a calculation performed in the query. I've also tried setting the Format propertys inside the query, but still it returns a whole number. Not sure what I'm overlooking. Since the ElapsedDays is coming from a Date field, would this prevent the decimal places from working?

    I thank you for any ideas you might have.

  2. #2
    Join Date
    Dec 2002
    Posts
    34
    Did you happen to find an answer to this?

  3. #3
    Join Date
    Dec 2002
    Location
    Alaska
    Posts
    19

    Red face Problem Solved

    Yes I did find the answer....idiot me.

    It helps if you use the right division character, i.e., "/" instead of "\".

    I had the two turned around. I really didn't notice it at first because the backwards slash does return a valid number.

    Stupid mistake. I'm curious now to know if the forward slash is used for anything in Access. I didn't find any reference to it in the help section.

    My numbers are behaving fine now.


    Originally posted by Schoon Dog
    Did you happen to find an answer to this?

  4. #4
    Join Date
    Feb 2003
    Location
    Plainsboro, NJ
    Posts
    1
    The backwards slash "\" is used for integer division.

    You can find it in the index of Access 97 help. It's in alphanumeric order, so "\" is listed near the top, along with all the special characters.

  5. #5
    Join Date
    Jan 2003
    Location
    Dallas/Houston
    Posts
    7

    other option

    you can also use

    Int, Fix Functions

    Returns the integer portion of a number.

Posting Permissions

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