Results 1 to 5 of 5

Thread: NumberFormat

  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What is the best number format for a percentage in a table that would always be less than 100%?

    Tom

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I'd use a number field, with Field Size set to Single or Double, and Format set to Percent.
    If you perform calculations including the field, Access will automatically interpret 50% as 0.5.

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. I thought the field size might be causing my problem but that was not it. I have several tax rate lookups that are working fine. I have a query that does the lookup and returns StateSalesTaxRate = 0.045 and LocalSalesTaxRate = 0.025. If I try to add these number by using Sum or plus, it returns 0.045.025 when I want it to return 0.07.

    Any Suggestion?

    Tom



    [quote name='HansV' post='791278' date='29-Aug-2009 09:33']I'd use a number field, with Field Size set to Single or Double, and Format set to Percent.
    If you perform calculations including the field, Access will automatically interpret 50% as 0.5.[/quote]

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Are you using DLookup to retrieve the values? DLookup tends to return a string value even if the field you're looking up is numeric.

    If so, try using Val(DLookup(...)) to force the return value to be a number.

  5. #5
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Many thanks. That solved the problem.

    Tom

    [quote name='HansV' post='791280' date='29-Aug-2009 09:53']Are you using DLookup to retrieve the values? DLookup tends to return a string value even if the field you're looking up is numeric.

    If so, try using Val(DLookup(...)) to force the return value to be a number.[/quote]

Posting Permissions

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