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

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!!

patentinv
patentinvAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

thenelsonCommented:
=Round(([tilepitchmult1]/100) + 0.49)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Arthur_WoodCommented:
Use the cInt function

cInt(.88) = 1

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

AW
0
harfangCommented:
Hi,

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:

    =CInt([tilepitchmult1]/100)

Cheers!
(°v°)
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

patentinvAuthor Commented:
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.

patentinv
0
patentinvAuthor Commented:
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"
    objAcc.CloseCurrentDatabase
    objAcc.Quit
   
    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!!!

thanks--patentinv
0
thenelsonCommented:
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!

Nelson
0
harfangCommented:
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(-[tilepitchmult1]/100)

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!
(°v°)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.