dbTalk Databases Forums  

Rounding Problem With Text Box Calculation

comp.databases.ms-access comp.databases.ms-access


Discuss Rounding Problem With Text Box Calculation in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Wayne
 
Posts: n/a

Default Rounding Problem With Text Box Calculation - 06-06-2010 , 03:43 AM






I have several bound text boxes on a form: Txt1Result, Txt2Result
etc. The value of each of these is based on a formula that draws a
value from another series of textboxes: Txt1Input, Txt2Input etc.

Therefore; Txt1Result = Txt1Input*SomeFormula, Txt2Result =
Txt2Input*Someformula etc.

The values in the "Result" textboxes is then summed into a "Total"
textbox. TxtTotal = Txt1Result + Txt2Result etc.

All textboxes are formatted as "fixed" to one decimal place. The
problem I am having is this: The "TxtTotal" textbox is showing a value
that is slightly different to the sum of the "Result" texboxes because
it is summing the underlying figures in the "Result" textboxes that
are in actual fact calculated to several decimal places, instead of
summing the displayed figures in the "Result" textboxes that the user
sees which are displayed to 1 decimal place.

Is there are way to force the "Total" textbox to sum the figures in
the "Result" texboxes as they are displayed to the user i.e. to 1
decimal place?

Reply With Quote
  #2  
Old   
Marshall Barton
 
Posts: n/a

Default Re: Rounding Problem With Text Box Calculation - 06-06-2010 , 05:01 AM






Wayne wrote:

Quote:
I have several bound text boxes on a form: Txt1Result, Txt2Result
etc. The value of each of these is based on a formula that draws a
value from another series of textboxes: Txt1Input, Txt2Input etc.

Therefore; Txt1Result = Txt1Input*SomeFormula, Txt2Result =
Txt2Input*Someformula etc.

The values in the "Result" textboxes is then summed into a "Total"
textbox. TxtTotal = Txt1Result + Txt2Result etc.

All textboxes are formatted as "fixed" to one decimal place. The
problem I am having is this: The "TxtTotal" textbox is showing a value
that is slightly different to the sum of the "Result" texboxes because
it is summing the underlying figures in the "Result" textboxes that
are in actual fact calculated to several decimal places, instead of
summing the displayed figures in the "Result" textboxes that the user
sees which are displayed to 1 decimal place.

Is there are way to force the "Total" textbox to sum the figures in
the "Result" texboxes as they are displayed to the user i.e. to 1
decimal place?

Try changing the result text boxes to use:

Txt1Result = Round(Txt1Input*SomeFormula, 1)

--
Marsh

Reply With Quote
  #3  
Old   
Wayne
 
Posts: n/a

Default Re: Rounding Problem With Text Box Calculation - 06-06-2010 , 11:56 PM



On Jun 6, 8:01*pm, Marshall Barton <marshbar... (AT) wowway (DOT) com> wrote:

Quote:
Try changing the result text boxes to use:

Txt1Result = Round(Txt1Input*SomeFormula, 1)

--
Marsh
Thanks Marshall. Worked well.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.