Adding controls

T

Tony Williams

Is there a way that I can have a calculated control that adds two numerical
figures with 3 decimal places but displays the answer as a whole number. In
other words I want the calculation to take into account the decimals but not
display the decimals on my form. I've tried setting the format to 0 decimals
places but that seems to ignore the decimals in my calculation.
Thanks
Tony
 
D

Douglas J Steele

In case any of the fields are Null, it would be better to use:

=Int(Nz([Field1],0) + Nz([Field2],0))
 
T

Tony Williams

Thanks for that BUT doesn't INT just drop off the decimal points without any
rounding?
Tony
Douglas J Steele said:
In case any of the fields are Null, it would be better to use:

=Int(Nz([Field1],0) + Nz([Field2],0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Jeff L said:
Try =Int([Field1] + [Field2])
 
T

Tony Williams

For eg 4.6 and 5.6 formatted as 0 decimals gives 5 and 6 , total 11 but Int
(4.6+5.6) gives 10?
I want 4.6 + 5.6 to give me 10. Is that possible?
I know this is a strange request but I do have a good reason for wanting to
do this.
Thanks
Tony
Douglas J Steele said:
In case any of the fields are Null, it would be better to use:

=Int(Nz([Field1],0) + Nz([Field2],0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Jeff L said:
Try =Int([Field1] + [Field2])
 
D

Douglas J Steele

True. You may want to use the Round function (but be aware that it uses
Banker's Rounding: .5 will always be rounded to the nearest even number,
whether that's up or down.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Tony Williams said:
Thanks for that BUT doesn't INT just drop off the decimal points without any
rounding?
Tony
Douglas J Steele said:
In case any of the fields are Null, it would be better to use:

=Int(Nz([Field1],0) + Nz([Field2],0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Jeff L said:
Try =Int([Field1] + [Field2])
 
T

Tony Williams

Found a solution in a "fix" of a formula using an IIf statement>
Thanks
Tony
Tony Williams said:
For eg 4.6 and 5.6 formatted as 0 decimals gives 5 and 6 , total 11 but
Int (4.6+5.6) gives 10?
I want 4.6 + 5.6 to give me 10. Is that possible?
I know this is a strange request but I do have a good reason for wanting
to do this.
Thanks
Tony
Douglas J Steele said:
In case any of the fields are Null, it would be better to use:

=Int(Nz([Field1],0) + Nz([Field2],0))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Jeff L said:
Try =Int([Field1] + [Field2])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top