Results 1 to 6 of 6
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Format Number to Whole number

    Hello i have a query that spits out an average value, however this value is soemthing like 2.7897654576 and i just want it to round up to the nearest whole number. Thanks!

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    taimysho0 -

    You might be able to use the CInt() function to convert into whole number.

    Hope this helps,

    Jim

  3. #3
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    thanks for the help!however, it didnt work. do you have another suggestion? thanks

  4. #4
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    taimysho0 - I gave it a brief test on a test query and it worked just fine. Although, I didn't test on an agg query.

    Here's what I used...

    new column in QBE - XX: CInt([fieldnamecontainingaverage])

    In the interim, I'll test on other agg queries and let you know.

    Jim

  5. #5
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    taimysho0 - When I tested the CInt() function on an agg query, I got an error. However, once I created a new query based on the agg query, the CInt() function as previously used produced the desired results.

    Hope this helps,

    Jim

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by taimysho0 View Post
    ...i just want it to round up to the nearest whole number. Thanks!
    If the OP wants the value rounded up, as stated, CInt() won't always do that. It will sometimes round down. So it depends on the actual intent of the poster.

    If they always want it rounded up, then something like this should work

    RoundUp: IIf([InputNumber]=Int([InputNumber]),[InputNumber],Int([InputNumber])+1)

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Number Format to General Format
    By mkc80 in forum Access
    Replies: 2
    Last Post: 05-05-2012, 02:10 AM
  2. number to Date format
    By nkuebelbeck in forum Queries
    Replies: 11
    Last Post: 11-01-2011, 01:29 PM
  3. Number format in queries
    By bullwinkle55423 in forum Queries
    Replies: 1
    Last Post: 08-16-2011, 06:55 PM
  4. Conditional number format
    By terryvanduzee in forum Forms
    Replies: 1
    Last Post: 07-14-2011, 01:29 AM
  5. Default number format?
    By joewilly1 in forum Queries
    Replies: 1
    Last Post: 11-24-2010, 09:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums