Can I force a calculation to round up to a whole number

Posted on 2006-04-08
Last Modified: 2006-11-18
Hi Experts,

I have a text box called (totbat)that has the following calculation in it's control source =([tilepitchmult1]/100)
tilepitchmult1 is another text box that has a value that always changes based on the value the user enters, Lets say tilepitchmult1 has a value of 88 in it, (totbat) will display .88 using the calculation =([tilepitchmult1]/100)

Can I force it to round up to a (1) a whole number?

If so can you describe how?

Thanks--I'll greatly appreciate any help!!

Question by:patentinv
    LVL 39

    Accepted Solution

    =Round(([tilepitchmult1]/100) + 0.49)
    LVL 44

    Assisted Solution

    Use the cInt function

    cInt(.88) = 1

    using the calculation = cInt([tilepitchmult1]/100)

    LVL 58

    Assisted Solution


    To round to an integer, use CIng() or CDbl(). If you need to specify a number of decimals, use Round(). In your case, I'd suggest:



    Author Comment

    I've been trying to figure this out for a couple of hours and within 5-10 minutes after posting my question, you experts once again give me the answer.

    All the your responses worked just as I was wanting it to.

    Thanks thenelson, Arthur_Wood/AW and harfang.


    Author Comment

    Hi thenelson,

    After putting the following responses to work, your response seems to be a better fit in my case, your response rounds all calculations up to the next whole number, which is exactly what I needed, the CInt doesn't round up, so in my case it it will not work.

    I Just wanted to thank you once again for your help, I don't know what I would do with out your help and ideas, I really appreciate it.

    Oh yea, I don't know if you remember the code you gave me for a question I posted, but to refresh your memory, here's the code once again you gave me,
    It copied a form from one .mdb file to another .mdb file when opened.

    Private Sub Form_Load()
    'Delete the old form.
        Dim objAcc As New Access.Application
        objAcc.OpenCurrentDatabase "C:\Documents and Settings\Chuck\Desktop\est.mdb"
        objAcc.DoCmd.DeleteObject acForm, "Contractprop"
        Set objAcc = Nothing

    'Copy the new form.
    DoCmd.CopyObject "C:\Documents and Settings\Chuck\Desktop\est.mdb", "Contractprop", acForm, "Contractprop"

    End Sub

    All this was working fine untill I implemented all the security into my .mdb file, most of what you helped me with also, thanks.
    But the reason I bring this up is I just wanted to let you know for future use you can use another line of code that will do the same thing but will bypass the login script and KillIt module which only opens the .mdb file in runtime mode.
    This is important because if the user updates his .mdb file by adding a form and it requires him to login into the.mdb file and the user that he logins into as must have modify rights in order to update this form with a new one, now all security is shot, and if the user has access installed then the .mdb file will try and open in full access and with the KillIt module implemented it will never even open so this user will not be able to update his form and I will lose out on a sell, so you see why this was a problem, we'll after a week of trying to figure out what to do I posted a question on rent a coder and got a solution, not cheap but it works. here's the line of code, that replaces yours and by passes all security and still copies the form.

    DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\3106.mdb", acForm, "Contractprop", "Contractprop", False

    Once again thanks for all your help!!!

    LVL 39

    Expert Comment

    CInt will round up if you add 0.49 to the number first.  I prefer Round as it better explains what I am doing when I come back to the code later.

    Thanks for the update.

    Glad to help and thank you very much for the points with "A" grade!

    Happy Computing!

    LVL 58

    Expert Comment

    Thanks for the split. I did overlook the "round up" request, sorry about that.

    While I'm at it, consider this slightly more accurate "round up" expression:


    Int() rounds *down*: Int(1.9999) = 1, but also Int(-1.0001) = -2. By using two minus signs, -Int(-x) becomes a totally accurate round up function...

    Cheers, and thanks again!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now